File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,11 @@ public function morph($format = 'json')
142142
143143 $ defaultContentType = $ this ->headers ->get ('Content-Type ' );
144144
145- $ this ->headers ->set ('Content-Type ' , $ formatter ->getContentType ());
145+ // If we have no content, we don't want to set this header, as it will be blank
146+ $ contentType = $ formatter ->getContentType ();
147+ if (! empty ($ contentType )) {
148+ $ this ->headers ->set ('Content-Type ' , $ formatter ->getContentType ());
149+ }
146150
147151 $ this ->fireMorphedEvent ();
148152
@@ -153,7 +157,9 @@ public function morph($format = 'json')
153157 } elseif (is_array ($ this ->content ) || $ this ->content instanceof ArrayObject || $ this ->content instanceof Arrayable) {
154158 $ this ->content = $ formatter ->formatArray ($ this ->content );
155159 } else {
156- $ this ->headers ->set ('Content-Type ' , $ defaultContentType );
160+ if (! empty ($ defaultContentType )) {
161+ $ this ->headers ->set ('Content-Type ' , $ defaultContentType );
162+ }
157163 }
158164
159165 return $ this ;
You can’t perform that action at this time.
0 commit comments