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

Use the code passed to ActionPayload for the HTTP status code #158

Merged
merged 3 commits into from
May 6, 2020

Conversation

yakubenko
Copy link
Contributor

Currently when we pass a status code to the constructor of the ActionPayload class it is only used as a field in our json response. If we don't provide an error to the constructor, the HTTP code is always 200. It doesn't work for all scenarios. In some cases I would return the code 202 and provide information on when the action will be fully completed.

Copy link
Member

@l0gicgate l0gicgate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! This is a good addition

tests/Application/Actions/ActionTest.php Outdated Show resolved Hide resolved
{
return $this->respondWithData(
[
'willBeDoneAt' => (new \DateTimeImmutable())->format(\DateTimeImmutable::ATOM)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix those two references as well and use new DateTimeImmutable()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@yakubenko yakubenko requested a review from l0gicgate May 5, 2020 17:29
@l0gicgate l0gicgate added this to the 4.0.4 milestone May 6, 2020
@l0gicgate l0gicgate merged commit e1372d1 into slimphp:master May 6, 2020
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

Successfully merging this pull request may close these issues.

2 participants