Skip to content

Commit

Permalink
Added test for missing cookie header value (dotnet#103969)
Browse files Browse the repository at this point in the history
* Test for missing cookie header value
* Disable this unit test on net48
  • Loading branch information
rokonec authored Jun 26, 2024
1 parent ce02b53 commit 9d008f4
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ await LoopbackServerFactory.CreateClientAndServerAsync(
});
}

[Theory]
[InlineData(null)]
[InlineData("")]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, ".NET Framework allows empty value of cookie header while net7+ behaves by the specs and prohibit it")]
public void AddCookieHeader_MissingValue_Throws(string? cookieValue)
{
var requestMessage = new HttpRequestMessage(HttpMethod.Get, "http://foo/bar") { Version = UseVersion };
Assert.Throws<FormatException>(
() => requestMessage.Headers.Add("Cookie", cookieValue)
);
}

[Fact]
public async Task GetAsync_AddMultipleCookieHeaders_CookiesSent()
{
Expand Down

0 comments on commit 9d008f4

Please sign in to comment.