src/middlewares/Jsonp.php
protected function buildJsonpResponse(Response $response) {
		$content     = (string)$response->getBody();
		$contentType = $response->getHeaderLine('Content-Type');

		if (strpos($contentType, 'application/json') === false) {
			$content = '"' . $content . '"';
		}

		$callback = "{$this->callbackName}({$content});";

		$newResponse = new Response(200);
		$newResponse->getBody()->write($callback);

		return $newResponse->withHeader('Content-Type', 'application/javascript');
	}
protected function buildJsonpResponse(Response $response) {
		$content     = (string)$response->getBody();
		$contentType = $response->getHeaderLine('Content-Type');

		if (strpos($contentType, 'application/json') === false) {
			$content = '"' . $content . '"';
		}

		$callback = "{$this->callbackName}({$content});";

		$newResponse = new Response(200);
		$newResponse->getBody()->write($callback);

		return $newResponse->withHeader('Content-Type', 'application/javascript');
	}
protected function buildJsonpResponse ( Response $ response ) { $ content = ( string ) $ response -> getBody ( ) ; $ contentType = $ response -> getHeaderLine ( 'Content-Type' ) ; if ( strpos ( $ contentType , 'application/json' ) === false ) { $ content = '"' . $ content . '"' ; } $ callback = "{$this->callbackName}({$content});" ; $ newResponse = new Response ( 200 ) ; $ newResponse -> getBody ( ) -> write ( $ callback ) ; return $ newResponse -> withHeader ( 'Content-Type' , 'application/javascript' ) ; }
Build Response with the callback.

@param Response $response

@return Response
Build Response with the callback .