Skip to content
Myr

Keep previous Content-Type for res.jsonp

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

backport of commit be997fd654243a8633aa059343665cf2c88fe609

authored by Alberto Leal · committed by Douglas Christopher Wilson · parent b0f72e1 · Browse files · 3 files+20 added−1 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+20 added−1 removed

  • tests:+18 added−0 removed
  • other:+2 added−1 removed

3 files+20 added−1 removed

modified:lib/response.js+1 added-1 removed
246 unmodified lines
247 var callback = this.req.query[app.get('jsonp callback name')];248249 // content-type250 this.charset = this.charset || 'utf-8';251 this.set('Content-Type', 'application/json');251 this.get('Content-Type') || this.set('Content-Type', 'application/json');252253 // fixup callback254 if (Array.isArray(callback)) {255 callback = callback[0];
567 unmodified lines
modified:test/res.jsonp.js+18 added
332 unmodified lines
333 done();334 })335 })336 })337338 it('should not override previous Content-Types', function(done){339 var app = express();340341 app.get('/', function(req, res){342 res.type('application/vnd.example+json');343 res.jsonp({ hello: 'world' });344 });345346 request(app)347 .get('/')348 .end(function(err, res){349 res.statusCode.should.equal(200);350 res.headers.should.have.property('content-type', 'application/vnd.example+json');351 res.text.should.equal('{"hello":"world"}');352 done();353 })354 })355})
modified:History.md+1 added
13.x2===34 * keep previous `Content-Type` for `res.jsonp`5 * update connect to 2.17.16 - fix `res.charset` appending charset when `content-type` has one7 - deps: express-session@1.2.08 - deps: morgan@1.1.1
1341 unmodified lines