From 075c836d165b272377fad8b26dc06c5cc7cd2498 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Sat, 20 Sep 2014 18:25:28 +0300 Subject: [PATCH] Fix missing jsonp feature with grunt-contrib-connect --- Gruntfile.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index dd21d72..fa17c04 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -74,6 +74,12 @@ module.exports = function(grunt) { port: 8082, middleware: function(connect, options) { return [ + function(req, res, next) { + res.jsonp = function(content) { + res.end(req.query.callback + "(" + JSON.stringify(content) + ")"); + }; + next(); + }, proxy() ]; }