Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…e header to application/json.
  • Loading branch information...
commit f2f9ed5c17763f1aad96a30cb53d93ac5b09cb58 1 parent e6b8832
@spalger spalger authored
Showing with 2 additions and 0 deletions.
  1. +1 −0  lib/request_overrider.js
  2. +1 −0  tests/test_intercept.js
View
1  lib/request_overrider.js
@@ -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
1  tests/test_intercept.js
@@ -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();
Please sign in to comment.
Something went wrong with that request. Please try again.