Skip to content

Commit

Permalink
Use application/javascript for JSON content type
Browse files Browse the repository at this point in the history
At the moment riak doesn't seem to recognize or
parse items with the content type application/json
in map functions - only application/javascript.
As a follow on, we need to recognize and set it
so we can use it for data storage.
  • Loading branch information
lstoll committed Feb 19, 2010
1 parent 2787de4 commit 6849631
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/riak.js
Expand Up @@ -39,7 +39,7 @@ Client.prototype.store = function(bucket, key, data, params) {

switch (params && params.type) {
case "json":
headers['content-type'] = "application/json";
headers['content-type'] = "application/javascript";
data = JSON.stringify(data);
break;

Expand Down Expand Up @@ -125,7 +125,8 @@ Client.prototype.makeRequest = function(method, url, headers, data) {

// don't try to json parse a response if there's no content
if (response.statusCode != 204
&& response.headers['content-type'] == 'application/json'
&& (response.headers['content-type'] == 'application/json' ||
response.headers['content-type'] == 'application/javascript')
&& Number(response.headers['content-length'])) {
resp.data = JSON.parse(body);
}
Expand Down

0 comments on commit 6849631

Please sign in to comment.