Skip to content

Comments

Keep original headers, so the PUT/POST operations aren't bloked#2111

Closed
xrogers wants to merge 3 commits intoapi-platform:4.0from
xrogers:patch-1
Closed

Keep original headers, so the PUT/POST operations aren't bloked#2111
xrogers wants to merge 3 commits intoapi-platform:4.0from
xrogers:patch-1

Conversation

@xrogers
Copy link

@xrogers xrogers commented Dec 27, 2024

Without this, some headers could be dropped and POST/PUT operations will not work anymore.

@vinceAmstoutz
Copy link
Member

Thanks for your contribution, @xrogers! However, your code addresses a custom need and should not be included in the documentation.

@xrogers
Copy link
Author

xrogers commented Jan 13, 2025

@vinceAmstoutz This is not correct. The provided example breaks in the current version POST actions. Try it out. It's not related to any specific use case, just basic functionality.

@J3m5
Copy link
Contributor

J3m5 commented Jan 14, 2025

Hello @xrogers, could you provide a reproduction, please?

In its current state, I can't see how adding a default parameter can change the return value of the getHeaders function.

The options object with the headers property, which is passed to the parseHydraDocumentation function, has this signature.

As you can see, it doesn't specify any parameter, and nothing is passed to it when it is called.

@xrogers
Copy link
Author

xrogers commented Jan 27, 2025

HI @J3m5
I'm quite swamped to prepare the example, but the issue relates to code from this change: api-platform/admin@66dca9c#diff-a3ad30593f2f6c73e4e5b94fbdec633ffec199309aa092ebdf98ad4ed10a95bcR501 for example
As you can see, content type header is modified in case of PATCH.
With the code from docs this header would be over-ridden/cleared.

@xrogers
Copy link
Author

xrogers commented Jan 27, 2025

Also see my last commit, somehow it is not visible in this PR: xrogers@30a9782

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.

3 participants