tencentyun / cos-demo

cos demo collection
15 stars 18 forks source link

uniapp cos post demo 抖音失败 #11

Closed z332406259 closed 1 year ago

z332406259 commented 1 year ago

Error

<Code

MalformedPOSTRequest </Code

<Message

The body of your POST request is not well-formed multipart/form-data. </Message

<Resource

/ </Resource

<RequestId

NjQ0YTFkZDdfMTM0ZTQ0MGJfOTFiZV8zNzExOWNm </RequestId

<TraceId

OGVmYzZiMmQzYjA2OWNhODk0NTRkMTBiOWVmMDAxODc0OWRkZjk0ZDM1NmI1M2E2MTRlY2MzZDhmNmI5MWI1OTI5MWRkM2I1ZDU3ZWE5Y2YzNDYzZTEzY2JlMjU3NDQ0ZDcwYzUyN2FkYjcxMmFjNjg5MGY0OWIyZWRlNDFhMGQ= </TraceId

抖音Tip:header 不支持设置 referer 、user-agent、content-type 字段字段

carsonxu commented 1 year ago

查不到错误原因。先关闭。 小程序应该都可以使用 PostObject 接口上传。 https://cloud.tencent.com/document/product/436/71469

z332406259 commented 1 year ago

image

dehui-1256972835.cos.ap-beijing.myqcloud.com --  
2 / 3 requests
1.5 kB / 6.4 kB transferred
0 B / 4.5 kB resources
  1. <Error>
    1. <Code>MalformedPOSTRequest</Code>
    2. <Message>The body of your POST request is not well-formed multipart/form-data.</Message>
    3. <Resource>/</Resource>
    4. <RequestId>NjQ5MDExOWNfNDc0ZTQ0MGJfMWEyNmJfNGZmMjVkYg==</RequestId>
    5. <TraceId>OGVmYzZiMmQzYjA2OWNhODk0NTRkMTBiOWVmMDAxODc0OWRkZjk0ZDM1NmI1M2E2MTRlY2MzZDhmNmI5MWI1OTI5MWRkM2I1ZDU3ZWE5Y2YzNDYzZTEzY2JlMjU3NDQ0ZDcwYzUyN2FkYjcxMmFjNjg5MGY0OWIyZWRlNDFhMGQ=</TraceId>
    6. </Error>
z332406259 commented 1 year ago

使用官方的demo 上传文件的时候 因为抖音小程序 uploadfile 不支持修改header,所以它的默认content-type 为 multipart/form-data,然后cos post上传就会报错The body of your POST request is not well-formed multipart/form-data. (抖音Tip:header 不支持设置 referer 、user-agent、content-type 字段字段),而如果是微信小程序上传就没有默认值所以就上传成功 image

z332406259 commented 1 year ago

@carsonxu