Allow more accept headers (#429)
This commit is contained in:
parent
849809771d
commit
d23f442a69
1 changed files with 42 additions and 9 deletions
|
|
@ -105,7 +105,7 @@ public class StreamableHttpServerConformanceTests(ITestOutputHelper outputHelper
|
|||
[InlineData("text/event-stream")]
|
||||
[InlineData("application/json")]
|
||||
[InlineData("application/json-text/event-stream")]
|
||||
public async Task PostRequest_IsNotAcceptable_WithSingleAcceptHeader(string singleAcceptValue)
|
||||
public async Task PostRequest_IsNotAcceptable_WithSingleSpecificAcceptHeader(string singleAcceptValue)
|
||||
{
|
||||
await StartAsync();
|
||||
|
||||
|
|
@ -116,6 +116,20 @@ public class StreamableHttpServerConformanceTests(ITestOutputHelper outputHelper
|
|||
Assert.Equal(HttpStatusCode.NotAcceptable, response.StatusCode);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("*/*")]
|
||||
[InlineData("text/event-stream, application/json;q=0.9")]
|
||||
public async Task PostRequest_IsAcceptable_WithWildcardOrAddedQualityInAcceptHeader(string acceptHeaderValue)
|
||||
{
|
||||
await StartAsync();
|
||||
|
||||
HttpClient.DefaultRequestHeaders.Accept.Clear();
|
||||
HttpClient.DefaultRequestHeaders.TryAddWithoutValidation(HeaderNames.Accept, acceptHeaderValue);
|
||||
|
||||
using var response = await HttpClient.PostAsync("", JsonContent(InitializeRequest), TestContext.Current.CancellationToken);
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetRequest_IsNotAcceptable_WithoutTextEventStreamAcceptHeader()
|
||||
{
|
||||
|
|
@ -128,6 +142,22 @@ public class StreamableHttpServerConformanceTests(ITestOutputHelper outputHelper
|
|||
Assert.Equal(HttpStatusCode.NotAcceptable, response.StatusCode);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("*/*")]
|
||||
[InlineData("application/json, text/event-stream;q=0.9")]
|
||||
public async Task GetRequest_IsAcceptable_WithWildcardOrAddedQualityInAcceptHeader(string acceptHeaderValue)
|
||||
{
|
||||
await StartAsync();
|
||||
|
||||
HttpClient.DefaultRequestHeaders.Accept.Clear();
|
||||
HttpClient.DefaultRequestHeaders.TryAddWithoutValidation(HeaderNames.Accept, acceptHeaderValue);
|
||||
|
||||
await CallInitializeAndValidateAsync();
|
||||
|
||||
using var response = await HttpClient.GetAsync("", HttpCompletionOption.ResponseHeadersRead, TestContext.Current.CancellationToken);
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task PostRequest_IsNotFound_WithUnrecognizedSessionId()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue