Allow more granular control over JSONP #1241

Closed
wants to merge 5 commits into
from

Conversation

Projects
None yet
4 participants
Contributor

daguej commented Jul 22, 2012

Proposed changes for #1240. This adds an options argument to Response.json():

res.json([status,] object[, options]);

Options are:

{
    jsonp: Boolean, // enable or disable JSONP output for this response
    jsonpCallbackName: String, // query string parameter to use for callback name
    jsonReplacer: Function || Array, // the replacer to send to JSON.stringify
    jsonSpaces: Boolean // tell JSON.stringify to pretty print
}

Each of these options overrides the corresponding global option. If any option is omitted, we fall back to the global setting.

lennym and others added some commits Mar 7, 2013

@lennym lennym Made quotes consistent
One-off use of double quotes aggravated my OCD.
8211562
@tj tj Merge pull request #1540 from fern4lvarez/master
Use End-of-line Node constant
b4f6124
@tj tj Merge pull request #1534 from lennym/patch-1
Made quotes consistent in generated app.js
158f452
@daguej daguej Merge branch 'master' of github.com:daguej/express
Conflicts:
	lib/response.js
8feb479
Member

jonathanong commented Sep 10, 2013

a little out of date. there's now res.jsonp().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment