fix: prevent multiple location headers on redirect (#3298) #3311
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem turned out to be specific to 0.7 Actix, which I did not expect.
This solution is what was proposed by @gbj in #3298, although I did not make the new code part of
extend_response
becauseextend_response
is also called inhandle_static_route
, and I don't think it needs this (maybe I'm wrong?).I believe a better solution would actually be to match the Axum behavior, that uses
http::HeaderMap::extend
: For merging map A with map B, if map B contains a key that is present in A, all values with such key in A are removed and all values with that key in B are added. That would at least be more consistent.I also still don't understand why both
server_fn::ServerFn::run_on_server
andleptos_actix::handle_server_fns_with_context
need to handle redirection to Referer, but I assume there is a reason.Took the oportunity to fix the surrounding comments too, to the best of my ability.