Do not compare + segments unless wildcards in either accept or priority#94
Do not compare + segments unless wildcards in either accept or priority#94willdurand merged 2 commits intowilldurand:2.xfrom weierophinney:hotfix/93
Conversation
Fixes #93. If there are no wildcard segments in either the subtype or + segment of either the Accept header or priority, do not attempt to compare them. Adds more tests for #92 as well, using `*` subtypes in both the Accept header and priorities, to validate that different combinations work as expected.
|
@willdurand , @meyerbaptiste — ready to review! |
|
And @dunglas ! |
|
Our test suite is green with this patch (see api-platform/core#1104), thanks @weierophinney! |
src/Negotiation/Negotiator.php
Outdated
|
|
||
| // If no wildcards in either the subtype or + segment, do nothing. | ||
| if (! ($acceptBase === '*' || $baseEqual) | ||
| || ! ($acceptSub === '*' || $prioritySub === '*' || $acceptPlus === '*' || $priorityPlus === '*')) { |
There was a problem hiding this comment.
According to PSR-2 when the if is multi-line the ) { needs to be on it's own line.
There was a problem hiding this comment.
Surprised my linter didn't catch that! Fixing now and pushing momentarily. Also, for internal consistency, removing spaces following ! operators.
|
@willdurand do you think you'll soon have time soon to merge this patch and create a new release? It's currently breaking all API Platform projects when running |
doing this right now, was on holidays earlier this week.. |
|
Thanks everyone! ❤️ |
Fixes #93. If there are no wildcard segments in either the subtype or
+segment of either the Accept header or priority, do not attempt to compare them.Adds more tests for #92 as well, using
*subtypes in both the Accept header and priorities, to validate that different combinations work as expected.