enable cors/tests.rs and make it pass#473
Merged
jplatte merged 3 commits intotower-rs:mainfrom Feb 22, 2024
Merged
Conversation
jplatte
reviewed
Feb 22, 2024
Member
jplatte
left a comment
There was a problem hiding this comment.
Thanks for the PR! In addition to the change requested below, can you also add a changelog entry?
GlenDC
pushed a commit
to plabayo/rama
that referenced
this pull request
Feb 22, 2024
based on feedback given by jplatte in tower-rs/tower-http#473
jplatte
reviewed
Feb 22, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
cors/tests.rswas added somewhere between now and the0.5release.However the file wasn't enabled, and this seemed to also hide a bug,
where we did not in fact preserve the already set
Vary(http response) header.Found while porting over the updated/added logic since 0.5 to https://github.com/plabayo/rama
(as that codebase uses ported code from
tower-async, which is ported fromtower,since then I have abandoned
tower-asyncas it did its job to proof that it was possible, but more drastic changeswere desired on my side for
rama. I do keep howeverramain sync with improvements made to codebases such astower-http, which is one of many reasons why I love to contribute totowerwhere I can and where it is desired)Solution
cors/mod.rscors/mod.rswhere we remove fromheadersinstead ofresponse_headersAs flagged on Discord it does also mean we need a third change where the order is not preserved,
and instead the custom (already set) Vary header will be at the end.