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

Fix body data contents #31

Merged
merged 4 commits into from
Aug 1, 2024
Merged

Fix body data contents #31

merged 4 commits into from
Aug 1, 2024

Conversation

rubenvanassche
Copy link
Member

@rubenvanassche rubenvanassche commented Jul 30, 2024

Until now, we only took a look for the request data body context to what was passed as $_POST variables. While when the content type is JSON we want to look at the PHP input stream.

This PR follows the same mechanism as a Laravel request.

And also fixes some issues with the snapshot testing.

Copy link
Member

@freekmurze freekmurze left a comment

Choose a reason for hiding this comment

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

Looks good to me. Just a small nitpick

$isJson = str_contains($contentType, '/json') || str_contains($contentType, '+json');

if ($isJson) {
return new InputBag((array) json_decode($this->request->getContent(), true));
Copy link
Member

Choose a reason for hiding this comment

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

Maybe break this up in a couple of separate statements to improve readability.

@rubenvanassche rubenvanassche merged commit 180f8ca into main Aug 1, 2024
19 checks passed
@rubenvanassche rubenvanassche deleted the fix-body-issues branch August 1, 2024 08:27
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