Skip to content
Myr

added failing jsonp tests for res.json()

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

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 87bc265 · Browse files · 1 file+37 added−0 removed
This commit

State

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

Diff stats

1 file+37 added−0 removed

  • tests:+37 added−0 removed

1 file+37 added−0 removed

modified:test/response.test.js+37 added
222 unmodified lines
223 , 'X-Foo': 'baz'224 }});225 },226227 'test #json() JSONP': function(){228 var app = express.createServer();229230 app.enable('jsonp callback');231232 app.get('/jsonp', function(req, res){233 res.header('X-Foo', 'bar');234 res.json({ foo: 'bar' }, { 'X-Foo': 'baz' }, 201);235 });236237 assert.response(app,238 { url: '/jsonp?callback=test' },239 { body: 'test({"foo":"bar"});'240 , status: 201241 , headers: {242 'Content-Type': 'text/javascript; charset=utf-8'243 , 'X-Foo': 'baz'244 }});245 246 assert.response(app,247 { url: '/jsonp?callback=baz' },248 { body: 'baz({"foo":"bar"});'249 , status: 201, headers: {250 'Content-Type': 'text/javascript; charset=utf-8'251 , 'X-Foo': 'baz'252 }});253 254 assert.response(app,255 { url: '/jsonp?callback=invalid()[]' },256 { body: 'invalid({"foo":"bar"});'257 , status: 201258 , headers: {259 'Content-Type': 'text/javascript; charset=utf-8'260 , 'X-Foo': 'baz'261 }});262 },263264 'test #contentType()': function(){265 var app = express.createServer();266 267 app.get('/html', function(req, res){
506 unmodified lines