Skip to content
This repository has been archived by the owner on Nov 8, 2020. It is now read-only.

Commit

Permalink
Fixed status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
klapuch committed Apr 8, 2017
1 parent 253f996 commit ab95db0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Core/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ final protected function flashMessage(string $content, string $type): void {
/**
* Redirect relatively to the given url
* @param string $url
* @param int $code
* @return void
*/
final protected function redirect(string $url): void {
header(sprintf('Location: %s/%s', $this->url->reference(), $url));
final protected function redirect(string $url, int $code = 200): void {
header(sprintf('Location: %s/%s', $this->url->reference(), $url), true, $code);
exit;
}

Expand Down
3 changes: 1 addition & 2 deletions Core/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ public function __toString(): string {
)
)
);
http_response_code(500);
header(sprintf('Location: %s/error', $this->uri->reference()));
header(sprintf('Location: %s/error', $this->uri->reference()), true, 500);
exit;
}
}
Expand Down

0 comments on commit ab95db0

Please sign in to comment.