Stefano Maglione
Stefano Maglione

Reputation: 4160

Laravel response status code with no message

Is it possible to send back a response only with status code 204 and no body message?

With this for example you always send back a json:

response()->json($data, $code);

Upvotes: 1

Views: 1851

Answers (1)

ied3vil
ied3vil

Reputation: 939

204 reponses do NOT have bodies.

http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#2xx_Success

Try responding like response(null, 204) -- not tested but it should work

Upvotes: 1

Related Questions