The middleware class with the same functionality already exists here: Middleware/Jsonp.php