Skip to content
Myr

Revert "remove charset from json responses. Closes #1631"

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This reverts commit 138d74aefa75b0287aab8a905406553ecd3073c5.

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent 752b5f7 · Browse files · 3 files+9 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+9 added−8 removed

  • tests:+8 added−8 removed
  • other:+1 added−0 removed

3 files+9 added−8 removed

modified:lib/response.js+1 added
186 unmodified lines
187 var spaces = app.get('json spaces');188 var body = JSON.stringify(obj, replacer, spaces);189190 // content-type191 this.charset = this.charset || 'utf-8';192 this.get('Content-Type') || this.set('Content-Type', 'application/json');193194 return this.send(body);195};
566 unmodified lines
modified:test/res.json.js+7 added-7 removed
modified:test/res.send.js+1 added-1 removed
200 unmodified lines
201202 request(app)203 .get('/')204 .end(function(err, res){205 res.headers.should.have.property('content-type', 'application/json');205 res.headers.should.have.property('content-type', 'application/json; charset=utf-8');206 res.text.should.equal('{"name":"tobi"}');207 done();208 })209 })
170 unmodified lines