cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Error in call to API function "files/upload": Bad HTTP "Content-Type"

Explorer | Level 3

Hi,

We are trying the upload a file from ZOHO deluge to dropbox upload API and getting the following error.

Error in call to API function "files/upload": Bad HTTP "Content-Type" header: "application/octet-stream; boundary=e4_HWM6hUnWSMO0XyNdrs9osravFMTxunGA". Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack".
 
How do I fix it?
3 Replies 3
Highlighted

Re: Error in call to API function "files/upload": Bad HTTP "Content-Type"

Dropboxer
Dropboxer

The Dropbox API /2/files/upload endpoint expects the HTTP request's "Content-Type" header to be  "application/octet-stream" or "text/plain; charset=dropbox-cors-hack". This error is indicating that your app is instead supplying "application/octet-stream; boundary=e4_HWM6hUnWSMO0XyNdrs9osravFMTxunGA".

That extra "boundary" portion is typically used with "multipart" requests, which the Dropbox API doesn't expect or support. You'll need to configure your HTTPS client to not send this kind of request. Your HTTPS client isn't made by Dropbox though, so I can't offer much help with that. You may want to refer to the documentation for your network client for information on how to configure this.

Highlighted

Re: Error in call to API function "files/upload": Bad HTTP "Content-Type"

Explorer | Level 3

Hi Greg.

 

Thanks for the reply, We are not setting any additional header except "application/octet-stream".

Here is what we are setting the headers:

mapOfHedder.put("Content-Type","application/octet-stream");

Is there any other thing which you can think of the reason for the specific error?

Unable to attach snapshot from select file else I could have done it.

 

Highlighted

Re: Error in call to API function "files/upload": Bad HTTP "Content-Type"

Dropboxer
Dropboxer

I see that you are setting a correct value in your code, but it looks like your network client is overriding that setting for some reason. We have seen that sometimes, e.g., where the network client later interprets something else, for instance the way the request body itself is being set, and then overwrites the Content-Type value. 

You'll need to investigate why your network client is overriding your value, and how to prevent that. That will be specific to your client though, so I can't provide specific instructons unfortunately.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?