Skip to content

Commit

Permalink
Allow body for GET and HEAD in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyzimarev committed Apr 3, 2024
1 parent 56a1161 commit 3165eaf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions test/RestSharp.Tests.Integrated/NtlmTests.cs
Expand Up @@ -7,16 +7,14 @@ namespace RestSharp.Tests.Integrated;
public class NtlmTests : CaptureFixture {
[Fact]
public async Task Does_Not_Pass_Default_Credentials_When_Server_Does_Not_Negotiate() {
if (!OperatingSystem.IsWindows()) return;
using var server = SimpleServer.Create(Handlers.Generic<RequestHeadCapturer>());

var client = new RestClient(new RestClientOptions(server.Url) { UseDefaultCredentials = true });

var client = new RestClient(new RestClientOptions(server.Url) { UseDefaultCredentials = true });
var request = new RestRequest(RequestHeadCapturer.Resource);

await client.ExecuteAsync(request);

Assert.NotNull(RequestHeadCapturer.CapturedHeaders);

var keys = RequestHeadCapturer.CapturedHeaders.Keys.Cast<string>().ToArray();

Assert.False(
Expand Down Expand Up @@ -58,4 +56,4 @@ public class NtlmTests : CaptureFixture {
"Authorization header not present in HTTP request from client, even though UseDefaultCredentials = true"
);
}
}
}
6 changes: 3 additions & 3 deletions test/RestSharp.Tests.Integrated/RequestBodyTests.cs
Expand Up @@ -9,7 +9,7 @@ public class RequestBodyTests {
const string ExpectedTextContentType = $"{TextPlainContentType}; charset=utf-8";
const string ExpectedTextContentTypeNoCharset = TextPlainContentType;

readonly WireMockServer _server = WireMockServer.Start();
readonly WireMockServer _server = WireMockServer.Start(s => s.AllowBodyForAllHttpMethods = true);

async Task AssertBody(Method method, bool disableCharset = false) {
var options = new RestClientOptions(_server.Url!) { DisableCharset = disableCharset };
Expand Down Expand Up @@ -64,10 +64,10 @@ public class RequestBodyTests {
AssertHasNoRequestBody(capturer);
}

[Fact(Skip = "GET with body is not supported on all platforms")]
[Fact]
public Task Can_Be_Added_To_GET_Request() => AssertBody(Method.Get);

[Fact(Skip = "GET with body is not supported on all platforms")]
[Fact]
public Task Can_Be_Added_To_HEAD_Request() => AssertBody(Method.Head);

[Fact]
Expand Down

0 comments on commit 3165eaf

Please sign in to comment.