visionmedia/express — pull request #1241 by daguej (2012-07-22 04:26:15+00:00)
Title: Allow more granular control over JSONP

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.