-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fixing a bug in Message::isJSON #4081
Conversation
…der had the encoding in it as well.
@MGatner I did notice that you put a deprecated flag on this function. I'm wondering why that is when you were the one that suggested the creation of the function. Given the change needed in this PR, I am wondering if it might be a better idea to keep it? |
I'm okay with this PR since it is a bugfix, but we did decide to deprecate that. I know I recommended it but since I have spent a lot of time with the HTTP layer. One of the goals is to incorporate a PSR-7 HTTP layer into the framework, and a corollary to that is relocating functionality to their proper locations. |
$header = $this->header('Content-Type')->getValue(); | ||
$parts = explode(';', $header); | ||
|
||
return in_array('application/json', $parts, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$header = $this->header('Content-Type')->getValue(); | |
$parts = explode(';', $header); | |
return in_array('application/json', $parts, true); | |
return in_array('application/json', explode(';', $this->header('Content-Type')->getValue()), true); |
use one line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mostafakhudair that's harder to read/understand the flow.
Thank you @caswell-wc |
You're welcome @samsonasik. |
Fixes the bug pointed out in a comment on #3719.
Description
Fixed an issue in isJSON that was breaking it if the content type header had the encoding in it as well.
Checklist: