Skip to content

Commit

Permalink
Added callback query check on response.send to autowrap JSON objects …
Browse files Browse the repository at this point in the history
…for simple webservice implementations
  • Loading branch information
davglass authored and tj committed Oct 12, 2010
1 parent 95ebbf2 commit a383b30
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/express/response.js
Expand Up @@ -84,6 +84,9 @@ http.ServerResponse.prototype.send = function(body, headers, status){
this.contentType('.json');
}
body = JSON.stringify(body);
if (this.req.query.callback) {
body = this.req.query.callback + '(' + body + ');';
}
}
break;
}
Expand Down

0 comments on commit a383b30

Please sign in to comment.