Skip to content

Account for header type when removing headers#1335

Merged
MihaZupan merged 2 commits into
dotnet:mainfrom
MihaZupan:content-headers
Oct 28, 2021
Merged

Account for header type when removing headers#1335
MihaZupan merged 2 commits into
dotnet:mainfrom
MihaZupan:content-headers

Conversation

@MihaZupan
Copy link
Copy Markdown
Member

Fixes #1334

Unlike TryAddWithoutValidation, HttpHeaders.Remove will throw if the header name does not belong to the header collection type.

As a result, trying to remove foo from content headers or trying to remove Content-Encoding from request headers will result in an exception.

Instead of trying to remove the header from both collections, we should check which collection the header belongs to first.

@MihaZupan MihaZupan added this to the YARP 1.0.0 milestone Oct 28, 2021
@MihaZupan MihaZupan requested a review from Tratcher as a code owner October 28, 2021 15:11
Comment thread test/ReverseProxy.Tests/Transforms/RequestTransformTests.cs
@MihaZupan MihaZupan merged commit e811677 into dotnet:main Oct 28, 2021
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.

Removing header from backend request causes exception

2 participants