Skip to content

Content-Type Header in Wrong Place #3

@thefringeninja

Description

@thefringeninja

Looking at the source code, the Content-Type header is being put on the HttpResponseMessage.Headers when it should go into HttpResponseMessage.Content.Headers.

Stack trace

   at System.Net.Http.Headers.HttpHeaders.GetHeaderDescriptor(String name)
   at FakeS3.Internal.FakeS3HttpMessageHandler.DoGetAsync(FakeS3Request fakeRequest)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)
   at Amazon.Runtime.Internal.HttpHandler`1.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.RedirectHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.Unmarshaller.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.S3.Internal.AmazonS3ResponseHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
AmazonS3Client 14|2023-09-01T12:52:34.324Z|ERROR|InvalidOperationException making request ListObjectsV2Request to http://localhost//home/blah/. Attempt 1. --> System.InvalidOperationException: Misused header name, 'Content-Type'. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects.
   at System.Net.Http.Headers.HttpHeaders.GetHeaderDescriptor(String name)
   at FakeS3.Internal.FakeS3HttpMessageHandler.DoGetAsync(FakeS3Request fakeRequest)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions