<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>CKAN: Ticket #1206: "Content-Type json" header scuppers package POST</title>
    <link>http://localhost/ticket/1206</link>
    <description>&lt;p&gt;
Compare these two requests to create a package:
&lt;/p&gt;
&lt;pre class="wiki"&gt;curl http://test.ckan.net/api/rest/package -d '{name:"test"}' -H 'Content-Type: application/json' -H 'X-CKAN-API-KEY: tester'
curl http://test.ckan.net/api/rest/package -d '{name:"test"}' -H 'X-CKAN-API-KEY: tester'
&lt;/pre&gt;&lt;p&gt;
The second one gets the payload through (ckan log):
&lt;/p&gt;
&lt;pre class="wiki"&gt;Retrieving request params: UnicodeMultiDict([('{name:"test"}', u'')])
&lt;/pre&gt;&lt;p&gt;
But the first one causes a &lt;a class="missing wiki"&gt;ServerError?&lt;/a&gt; because the payload (name:&amp;#34;test&amp;#34;) doesn't make it to request.POST or request.params:
&lt;/p&gt;
&lt;pre class="wiki"&gt;Retrieving request params: UnicodeMultiDict([])
&lt;/pre&gt;&lt;p&gt;
The only difference is the "&lt;a class="missing wiki"&gt;ContentType?&lt;/a&gt;: application/json" header, which seems a reasonable thing to include. Javascript lib backbone.js (for example) inserts this automatically.
&lt;/p&gt;
&lt;p&gt;
So why does this header cause the payload to not get through to the request object?
&lt;/p&gt;
</description>
    <language>en-us</language>
    <image>
      <title>CKAN</title>
      <url>http://assets.okfn.org/p/ckan/img/ckan_logo_shortname.png</url>
      <link>http://localhost/ticket/1206</link>
    </image>
    <generator>Trac 0.12.3</generator>
    <item>
      
        <dc:creator>dread</dc:creator>

      <pubDate>Thu, 30 Jun 2011 16:10:16 GMT</pubDate>
      <title>status changed; resolution set</title>
      <link>http://localhost/ticket/1206#comment:1</link>
      <guid isPermaLink="false">http://localhost/ticket/1206#comment:1</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;new&lt;/em&gt; to &lt;em&gt;closed&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;resolution&lt;/strong&gt;
                set to &lt;em&gt;fixed&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Fixed with cset:149be76faabc on default branch, aiming for ckan 1.4.2.
&lt;/p&gt;
&lt;p&gt;
Thanks for help from Eric Lemoine.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>