-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Writing to the response body is invalid for responses with status code 204 #306
Comments
If possible, please provide the mappings you use. |
Thats the thing, I dont see that it's related to a mapping that I have added. is it possible? |
Or provide a demo project ? |
@StefH just to update, I have tried to make my logs to be "Debug". still havent really figured out the issue, but I saw this error one time:
and I would like to ask if you could create pre-release version with the following change in the WireMockMiddleware class: In many cases I see the following error without any exception stack trace: "HttpStatusCode set to 500" because you error message without the exception in this line: _options.Logger.Error("HttpStatusCode set to 500"); The error is very general, could add the exception itself to the error? Thanks, Greg |
Just to clarify, Im using wiremock as an mocking infra in a company I work for. Currently I have around 20 mocks set up on different ports and automation nightlies are running at the same time, adding miltiple mappings and sometimes the errors that Ive mentioned happen so without the logging, its hard to understand which mapping causes the error. |
You mean this line?
|
Can you install This version contains more logging. e423a99 |
yes exactly. It would be great if you could add the exception to the error message or perhaps even the mapping that caused it.. |
Can you install and try WireMock.Net.1.0.27-ci-11567.nupkg from MyGet? |
sure, ill try and let you know. |
I have tried WireMock.Net.1.0.27-ci-11567 and the logs that you have added help! I saw the reason for the error, it was a mapping that led to service that took really long time to respond. |
Good to hear. Also check if #308 is still happening, or maybe this is also fixed. |
Closing |
Hi,
Many times I see the following error when I use wiremock:
"HttpStatusCode set to 500 System.InvalidOperationException: Writing to the response body is invalid for responses with status code 204. at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ThrowWritingToResponseBodyNotSupported() at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.WriteAsync(ReadOnlyMemory`1 data, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) at WireMock.Owin.Mappers.OwinResponseMapper.MapAsync(ResponseMessage responseMessage, HttpResponse response) at WireMock.Owin.WireMockMiddleware.InvokeInternal(HttpContext ctx) at WireMock.Owin.GlobalExceptionMiddleware.InvokeInternal(HttpContext ctx)"
it comes from the following class:
WireMock.Owin.GlobalExceptionMiddleware+d__7.MoveNext
I thought that perhaps I'm trying to add mapping with response content for http status 204 but I havent found anything like that.
Do you have any idea about this sort of error?
Thanks,
Greg
The text was updated successfully, but these errors were encountered: