Permalink
Browse files

When the reply body is JSON.stringified, it also sets the content-typ…

…e header to application/json.
  • Loading branch information...
1 parent e6b8832 commit f2f9ed5c17763f1aad96a30cb53d93ac5b09cb58 @spalger spalger committed Dec 13, 2013
Showing with 2 additions and 0 deletions.
  1. +1 −0 lib/request_overrider.js
  2. +1 −0 tests/test_intercept.js
View
@@ -191,6 +191,7 @@ function RequestOverrider(req, options, interceptors, remove, cb) {
responseBody = new Buffer(responseBody);
} else {
responseBody = JSON.stringify(responseBody);
+ response.headers['content-type'] = 'application/json';
}
}
View
@@ -841,6 +841,7 @@ test("reply with JSON", function(t) {
res.setEncoding('utf8');
t.equal(res.statusCode, 200);
+ t.equal(res.headers['content-type'], 'application/json');
res.on('end', function() {
t.ok(dataCalled);
scope.done();

0 comments on commit f2f9ed5

Please sign in to comment.