-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Describe the bug
Apologies if I'm completely wrong here. Over here I'm upgrading a middleware to 3.x and System.Text.Json.
I'm trying to optimize a deserialization from the HttpRequest.Body by pre-allocating a buffer using the shared array pool given HttpRequest.ContentLength. See here. Problem is, when our integration tests run, which use HttpClient.PostAsync(..., new StringContent(...)) to post to a TestHost, the Content-Length header is always null.
Is this is a limitation of the test host, or a bug? I guess I could write a unit test the specific internals of that function.
To Reproduce
- Clone
PRbranch linked above. - Put a breakpoint in
GraphQLHttpMiddlewarein the JsonContentType case of the switch statement. - Test Explorer > Samples.Server.Tests (netcoreapp3.1) > right-click "Single_Query..." and Debug.
- Breakpoint will be hit and
httpRequest.ContentLengthwill be null.
