我正在尝试使用 cfhttp 将文件上传到保管箱 api。我从 Dropbox 收到一条错误消息,指出 Content-Type 不正确:
错误的 HTTP“Content-Type”标头:“application/octet-stream,multipart/form-data;boundary=-------------- ---7d0d117230764"。期待“application/octet-stream”、“text/plain; charset=dropbox-cors-hack”之一。
在我看来,ColdFusion 将 multipart.form-data 附加到我在 cfhttpparam 标头中定义的内容类型。我不知道如何防止这种情况。我正在使用下面的代码:
<cfhttp method="post" url="https://content.dropboxapi.com/2/files/upload" result="uploadFile" multipart="no">
<cfhttpparam type="header" name="Authorization" value="Bearer #DropboxAccessToken#">
<cfhttpparam type="header" name="Dropbox-API-Arg" value="#serializeJSON(stFields)#">
<cfhttpparam type="header" name="Dropbox-API-Select-User" value="#DropboxMemberID#">
<cfhttpparam type="header" name="Content-Type" value="application/octet-stream">
<cfhttpparam type="file" name="1_1036.gif" file="C:\1_1036.gif">
</cfhttp>
关于可能发生的事情有什么想法吗?