enable cors/tests.rs and make it pass #473
Merged
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.rs
was added somewhere between now and the0.5
release.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-async
as it did its job to proof that it was possible, but more drastic changeswere desired on my side for
rama
. I do keep howeverrama
in sync with improvements made to codebases such astower-http
, which is one of many reasons why I love to contribute totower
where I can and where it is desired)Solution
cors/mod.rs
cors/mod.rs
where we remove fromheaders
instead ofresponse_headers
As 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.