<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Missing or empty HTTP &amp;quot;Content-Type&amp;quot; in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Missing-or-empty-HTTP-quot-Content-Type-quot/m-p/234638#M12822</link>
    <description>&lt;P&gt;I am having a terrible time trying to complete a large file upload using REST/HTTP Post.&lt;/P&gt;&lt;P&gt;I am able to start an upload session and append to an active session but when I call finsih I get the following error:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error in call to API function "files/upload_session/finish": Missing or empty HTTP "Content-Type" header.&amp;nbsp; Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My C++ code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;bool FinishSession(char* TargetPath,char* SessionID, char* Offset)
{
CRect rest;
bool bAutoReconnect=true;
if(!rest.Connect("content.dropboxapi.com",443,true,bAutoReconnect))
&amp;nbsp; return 0;

//build dropbox args
char DropboxArgs[255];
&amp;nbsp;ZeroMemory(DropboxArgs,255);
&amp;nbsp;sprintf(DropboxArgs,"{\"cursor\": {\"session_id\":\"%s\",\"offset\":%s},\"commit\":{\"path\":\"%s\",\"mode\":{\".tag\":\"overwrite\"},\"autorename\":false,\"mute\":false}}",SessionID,Offset,TargetPath);

//add header vars
rest.AddHeader("Authorization",AxxToken);
rest.AddHeader("Content-Type","application/octet-stream");
rest.AddHeader("Dropbox-API-Arg",DropboxArgs);

//POST to Dropbox
const char *response = rest.Post("POST","/2/files/upload_session/finish");
if(response==NULL)
&amp;nbsp; return 0;

CJson json(response);
if(!json.Find("name"))
{
&lt;P&gt;&lt;FONT color="red"&gt;//response=Error in call to API function "files/upload_session/finish": Missing or empty HTTP "Content-Type" header.&amp;nbsp; Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack"&lt;/FONT&gt;&lt;/P&gt;
&amp;nbsp; return 0;
}
return 1;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:20:29 GMT</pubDate>
    <dc:creator>email_toan</dc:creator>
    <dc:date>2019-05-29T09:20:29Z</dc:date>
    <item>
      <title>Missing or empty HTTP "Content-Type"</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Missing-or-empty-HTTP-quot-Content-Type-quot/m-p/234638#M12822</link>
      <description>&lt;P&gt;I am having a terrible time trying to complete a large file upload using REST/HTTP Post.&lt;/P&gt;&lt;P&gt;I am able to start an upload session and append to an active session but when I call finsih I get the following error:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error in call to API function "files/upload_session/finish": Missing or empty HTTP "Content-Type" header.&amp;nbsp; Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My C++ code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;bool FinishSession(char* TargetPath,char* SessionID, char* Offset)
{
CRect rest;
bool bAutoReconnect=true;
if(!rest.Connect("content.dropboxapi.com",443,true,bAutoReconnect))
&amp;nbsp; return 0;

//build dropbox args
char DropboxArgs[255];
&amp;nbsp;ZeroMemory(DropboxArgs,255);
&amp;nbsp;sprintf(DropboxArgs,"{\"cursor\": {\"session_id\":\"%s\",\"offset\":%s},\"commit\":{\"path\":\"%s\",\"mode\":{\".tag\":\"overwrite\"},\"autorename\":false,\"mute\":false}}",SessionID,Offset,TargetPath);

//add header vars
rest.AddHeader("Authorization",AxxToken);
rest.AddHeader("Content-Type","application/octet-stream");
rest.AddHeader("Dropbox-API-Arg",DropboxArgs);

//POST to Dropbox
const char *response = rest.Post("POST","/2/files/upload_session/finish");
if(response==NULL)
&amp;nbsp; return 0;

CJson json(response);
if(!json.Find("name"))
{
&lt;P&gt;&lt;FONT color="red"&gt;//response=Error in call to API function "files/upload_session/finish": Missing or empty HTTP "Content-Type" header.&amp;nbsp; Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack"&lt;/FONT&gt;&lt;/P&gt;
&amp;nbsp; return 0;
}
return 1;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:20:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Missing-or-empty-HTTP-quot-Content-Type-quot/m-p/234638#M12822</guid>
      <dc:creator>email_toan</dc:creator>
      <dc:date>2019-05-29T09:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Missing or empty HTTP "Content-Type"</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Missing-or-empty-HTTP-quot-Content-Type-quot/m-p/234667#M12825</link>
      <description>&lt;P&gt;What is CRect?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My best&amp;nbsp;guess would be that&amp;nbsp;the library you're using to make HTTP requests omits the Content-Type header when there's no POST body.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jul 2017 17:27:41 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Missing-or-empty-HTTP-quot-Content-Type-quot/m-p/234667#M12825</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2017-07-30T17:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Missing or empty HTTP "Content-Type"</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Missing-or-empty-HTTP-quot-Content-Type-quot/m-p/234927#M12869</link>
      <description>&lt;P&gt;That's actually a typo.&amp;nbsp; Yes, CRest is a class library I used to make HTTP requests.&amp;nbsp; Removing the Content-Type header didn't work for me, however your responde lead me to discover if I post with a body, the API method succeeds.&amp;nbsp; So I've updated my logic to accomodate this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steve, thank you for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2017 15:33:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Missing-or-empty-HTTP-quot-Content-Type-quot/m-p/234927#M12869</guid>
      <dc:creator>email_toan</dc:creator>
      <dc:date>2017-08-01T15:33:49Z</dc:date>
    </item>
  </channel>
</rss>

