Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ability to change HTTP status code within load() method? #31

Open
columbian-chris opened this issue Jul 28, 2021 · 0 comments
Open

ability to change HTTP status code within load() method? #31

columbian-chris opened this issue Jul 28, 2021 · 0 comments

Comments

@columbian-chris
Copy link

Example:

Add to functions.php:

Routes::map('hello/world', function( $params ) {
	Routes::load('hello-world.php');
});

hello-world.php:

<?php
http_response_code(502);
die('hello world');

The browser shows a 200 response code, not a 502 as attempted within the route (hello-world.php). Obviously the Routes::load() method throws a 200 by default (which can be changed by passing a different code as the fourth parameter), but I'm wondering - is there a way that I can customize the status code within the loaded route?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant