Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.5.33 Returns always StatusCode 500 #988

Closed
macalbert opened this issue Aug 4, 2023 · 2 comments
Closed

v1.5.33 Returns always StatusCode 500 #988

macalbert opened this issue Aug 4, 2023 · 2 comments
Assignees
Labels

Comments

@macalbert
Copy link

Describe the bug

Version 1.5.33 always returns StatusCode 500 ' Internal Server Error'.

Expected behaviour:

Should return the StatusCode provided in the ResponseBuilder.

Test to reproduce

using System.Net;
using System.Text;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;

public class SomeApiClientTests
{
    [Fact]
    public async Task Should_ReturnCreated_When_PostRequestedIsValid()
    {
        // Arrange        
        var server = WireMockServer.Start();
        server.Given(Request.Create().UsingPost().WithPath("/some/endpoint"))
              .RespondWith(Response.Create().WithStatusCode(HttpStatusCode.Created));
        var httpClient = new HttpClient { BaseAddress = new Uri(server.Url!) };
        var requestUri = new Uri(httpClient.BaseAddress!, "some/endpoint");
        var content = new StringContent(string.Empty, Encoding.UTF8, "application/json");

        // Act
        var actual = await httpClient.PostAsync(requestUri, content);

        // Assert
        actual.StatusCode.Should().Be(HttpStatusCode.Created);
    }
}

Other related info

Ran under .Net 7 with Microsoft Visual Studio Community 2022 (64-bit) -Version 17.6.5

@macalbert macalbert added the bug label Aug 4, 2023
@StefH
Copy link
Collaborator

StefH commented Aug 4, 2023

Hello @macalbert.
Thanks for reporting.

I will release a new version soon.

#989

@StefH StefH self-assigned this Aug 4, 2023
@StefH StefH closed this as completed Aug 4, 2023
@macalbert
Copy link
Author

Thanks @StefH!! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants