laracoft's avatar

No way to set HTTP status

HTTP/2 400 
server: openresty
date: Sat, 04 Apr 2026 11:28:22 GMT
content-type: text/html; charset=utf-8
cache-control: no-cache, private
x-ratelimit-limit: 60
x-ratelimit-remaining: 57
phpdebugbar-id: 01KNC40K97P25K2JC4TFG74HMH
access-control-allow-origin: *

Calling abort(400, 'No parameters provided'); gives me the above, is there a way to show my message like when I'm calling response()->setStatusCode(400, 'Empty')?

1 like
3 replies
Glukinho's avatar

abort function puts a message to response body, not in status string. Maybe you should write your own helper function for that.

imranbru's avatar
imranbru
Best Answer
Level 4

You can’t HTTP/2 drops custom reason-phrases. abort(400,'…') only puts your message in the body. If you need a label, return it in the body (e.g. json “error”: “…”) or add a custom header.

martinbean's avatar

@laracoft You _have _set the status? It clear shows it’s set the status to 400 as requested:

HTTP/2 400 

Please or to participate in this conversation.