Closed pardahlman closed 7 years ago
Hello @pardahlman,
It's a well-known bug. Actually, even curl add the Accept header "/" by default... FosRestBundle is not very customisable on that point and it leads to some weird behavior :/
It will be fixed in a patch. Your workaround is the good one.
Thanks for your report !
Alexandre
Aloha!
Just want to make sure that I understand what you're saying. Do you mean that the bug in Akeneo PIM's CheckHeadersRequestSubscriber class is well-known and will be fixed? If so, no further questions! 🙂
Yes, it will be fix in a 1.7 patch :)
Perfecto! I've gotten my answer. You can deside if you want to close this ticket or keep it open for reference!
Thank you for your feedback @pardahlman and @ahocquard for the answer.
Except if I'm wrong, the issue is still valid so I let the issue open :)
@mickaelandrieu Not fixed yet, I hope it will be soon.
Hello @pardahlman, the latest 1.7 version, the 1.7.5 contains the fix for this issue. You can now update your PIM installation. Kind regards,
Top of the morning 🌤
I'm running Akeneo 1.7.2, same instance as in #6099.
I'm trying to use the endpoint for creating a media file, which according to the documentation requires two headers:
Content-type
Equal tomultipart/form-data
, no other value allowedAuthorization
Equal to 'Bearer xxx',xxx
being the authentication tokenI posted a request with the current headers
And I got the following response from the API
The message comest from
CheckHeadersRequestSubscriber
. When digging further into this, the secondary value (retrieved from$best->getValue()
) comes originally from this line of codeThat retrieves the Accept header. A bit down the file there is a check if the verb is
POST
and if so it executes this line of code:That retrieves the Content-type header. These two values are then compared, which, if I'm reading the code right, is not correct.
Worth noting also, when looking at the headers of my original request there is no Accept header present, but still
application/json
is found as the "best" match.As a work-around, I added the Accept header to my request
And the header check passed.