WireMock.Net: BodyParser Newtonsoft.Json.JsonReaderException

Describe the bug

I keep getting a JsonReaderException when Wiremock is trying to parse a request body. It works on my build server (linux dotnet image), not on my local machine (Windows 10, .NET Core 3.1). I managed to get it working temporarily by deleting the bin folder and rebuilding, but that is no longer working.

image

image

I am using xUnit with Microsoft Visual Studio Professional 2019 Version 16.9.3

Expected behavior:

A clear and concise description of what you expected to happen.

Wiremock should read the incoming request and serve the JSON response.

Test to reproduce

The failure is on a GET request

                .Given(Request.Create()
                    .WithPath($"/SomeProjectKey/carts/{cartId}")
                    .UsingGet())
                .RespondWith(
                    Response.Create()
                        .WithStatusCode(200)
                        .WithBodyFromFile("./TestData/GetCart.json")
                );

Other related info

Provide additional information if any.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16

Most upvoted comments

No worries. I am glad your issue is solved.