File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,16 @@ public static function makeFromExisting(IlluminateResponse $old)
9595 */
9696 public static function makeFromJson (JsonResponse $ json )
9797 {
98- $ new = static ::create (json_decode ($ json ->getContent (), true ), $ json ->getStatusCode ());
98+ $ content = $ json ->getContent ();
99+
100+ // If the contents of the JsonResponse does not starts with /**/ (typical laravel jsonp response)
101+ // we assume that it is a valid json response that can be decoded, or we just use the raw jsonp
102+ // contents for building the response
103+ if (! starts_with ($ json ->getContent (), '/**/ ' )) {
104+ $ content = json_decode ($ json ->getContent (), true );
105+ }
106+
107+ $ new = static ::create ($ content , $ json ->getStatusCode ());
99108
100109 $ new ->headers = $ json ->headers ;
101110
You can’t perform that action at this time.
0 commit comments