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

Check for content type starting with application/x-www-form-urlencoded #15

Closed
wants to merge 4 commits into from

Conversation

georgeboot
Copy link
Contributor

@georgeboot georgeboot commented Nov 14, 2022

Because content type could be application/x-www-form-urlencoded;charset=UTF-8.

It currently doesn't recognise the request as an url encoded form, and hence the form data is not available inside Laravel.

This should probably be fixed upstream as its also in Brefs PSR-7 bridge (which inspired this code).

Lastly, shouldn't we use something like https://symfony.com/doc/current/components/psr7.html#converting-objects-implementing-psr-7-interfaces-to-httpfoundation to convert the request from PSR-7 to Symfony instead?

@georgeboot
Copy link
Contributor Author

Submitted brefphp/bref#1325

@georgeboot
Copy link
Contributor Author

If you agree with #16, this PR should be closed.

@@ -84,7 +85,7 @@ protected static function parseBodyAndUploadedFiles(HttpRequestEvent $event): ar
$contentType = $event->getContentType();

if (null !== $contentType && 'POST' === $event->getMethod()) {
if ('application/x-www-form-urlencoded' === $contentType) {
if (Str::startsWith($contentType, 'application/x-www-form-urlencoded')) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we do contains()?

@tillkruss tillkruss closed this Nov 16, 2022
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