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')
142
142
143
143
$ defaultContentType = $ this ->headers ->get ('Content-Type ' );
144
144
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
+ }
146
150
147
151
$ this ->fireMorphedEvent ();
148
152
@@ -153,7 +157,9 @@ public function morph($format = 'json')
153
157
} elseif (is_array ($ this ->content ) || $ this ->content instanceof ArrayObject || $ this ->content instanceof Arrayable) {
154
158
$ this ->content = $ formatter ->formatArray ($ this ->content );
155
159
} else {
156
- $ this ->headers ->set ('Content-Type ' , $ defaultContentType );
160
+ if (!empty ($ defaultContentType )) {
161
+ $ this ->headers ->set ('Content-Type ' , $ defaultContentType );
162
+ }
157
163
}
158
164
159
165
return $ this ;
You can’t perform that action at this time.
0 commit comments