move setHeader charset patch to .set

note that application/json no longer adds charset=utf-8. could be a
regression.

closes #1952
See also: https://github.com/broofa/node-mime/issues/86
This commit is contained in:
Jonathan Ong
2014-03-07 16:32:41 -08:00
parent 3cf7b2e39e
commit bad55f7977
8 changed files with 42 additions and 87 deletions

View File

@@ -114,7 +114,7 @@ describe('res', function(){
request(app)
.get('/')
.end(function(err, res){
res.headers.should.have.property('content-type', 'application/json; charset=utf-8');
res.headers.should.have.property('content-type', 'application/json');
res.text.should.equal('null');
done();
})
@@ -132,7 +132,7 @@ describe('res', function(){
request(app)
.get('/')
.end(function(err, res){
res.headers.should.have.property('content-type', 'application/json; charset=utf-8');
res.headers.should.have.property('content-type', 'application/json');
res.text.should.equal('["foo","bar","baz"]');
done();
})
@@ -150,7 +150,7 @@ describe('res', function(){
request(app)
.get('/')
.end(function(err, res){
res.headers.should.have.property('content-type', 'application/json; charset=utf-8');
res.headers.should.have.property('content-type', 'application/json');
res.text.should.equal('{"name":"tobi"}');
done();
})
@@ -217,7 +217,7 @@ describe('res', function(){
.get('/')
.end(function(err, res){
res.statusCode.should.equal(201);
res.headers.should.have.property('content-type', 'application/json; charset=utf-8');
res.headers.should.have.property('content-type', 'application/json');
res.text.should.equal('{"id":1}');
done();
})
@@ -236,7 +236,7 @@ describe('res', function(){
.get('/')
.end(function(err, res){
res.statusCode.should.equal(201);
res.headers.should.have.property('content-type', 'application/json; charset=utf-8');
res.headers.should.have.property('content-type', 'application/json');
res.text.should.equal('{"id":1}');
done();
})