You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat/fix: view() and render() cannot set HTTP status code #39
The view() and render() methods do not accept a status code parameter,
making it impossible to render a view with a non-200 HTTP status code.
Steps to reproduce
Trying to render a 404 view with the correct status code:
// None of these work — browser always receives 200response()->status(404)->render('errors/404');
response()->withHeader('X-Custom-Header', 'value', true, 404)->render('errors/404');
Root cause
Internally, view() calls markup() which calls send() immediately.
By the time any status code is set, headers are already sent.
This is fully backward compatible since $code defaults to 200.
Use case
Essential for displaying error pages (404, 403, 500) with the correct HTTP status code
via the standard response API, without having to bypass it
by using low-level PHP functions such as http_response_code(), which may not work.
Activity