(req, res, next)
| 24 | */ |
| 25 | function jsonp() { |
| 26 | function _jsonp(req, res, next) { |
| 27 | var q = req.getQuery(); |
| 28 | |
| 29 | // If the query plugin wasn't used, we need to hack it in now |
| 30 | if (typeof q === 'string') { |
| 31 | req.query = qs.parse(q); |
| 32 | } |
| 33 | |
| 34 | if (req.query.callback || req.query.jsonp) { |
| 35 | res.setHeader('Content-Type', 'application/javascript'); |
| 36 | } |
| 37 | |
| 38 | next(); |
| 39 | } |
| 40 | |
| 41 | return _jsonp; |
| 42 | } |