Skip to content
Myr

Revert "removed jsonp stripping"

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

This reverts commit 0ae18bca6075c8f6d9a7d58405c5f52c1ae61958.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent fc60dfc · Browse files · 2 files+19 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

2 files+19 added−1 removed

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

2 files+19 added−1 removed

modified:lib/response.js+1 added-1 removed
133 unmodified lines
134 this.header('Content-Type', 'application/json');135136 if (callback && jsonp) {137 this.header('Content-Type', 'text/javascript');138 body = callback + '(' + body + ');';138 body = callback.replace(/[^\w$.]/g, '') + '(' + body + ');';139 }140141 return this.send(body, headers, status);142};
320 unmodified lines
modified:test/response.test.js+18 added
211 unmodified lines
212 , status: 201, headers: {213 'Content-Type': 'text/javascript; charset=utf-8'214 , 'X-Foo': 'baz'215 }});216 217 assert.response(app,218 { url: '/jsonp?callback=invalid()[]' },219 { body: 'invalid({"foo":"bar"});'220 , status: 201221 , headers: {222 'Content-Type': 'text/javascript; charset=utf-8'223 , 'X-Foo': 'baz'224 }});225 },226227 'test #json() JSONP': function(){228 var app = express.createServer();
20 unmodified lines
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();
508 unmodified lines