Skip to content

Post requests with Stream contents seem to missing content-type headers #291

Closed

Description

@Numpsy

Hi,

When doing some testing of a SwaggerProvider generated file upload function (using s StreamContent to send a file to an endpoint with an expected content-type of application/octet-stream), I found that the client didn't seem to be setting a Content-Type header on the request.

I noticed that after using the client with a test server setup that expected the content type to be specified and returns an error if it's missing.

Is that right?

I checked this via the unit tests by changing one of the existing file upload tests to check for a content-type being specified - e.g. 35549bb and fail if it's missing.

I see that there's code here to set a content-type header on the outer request but I believe there can be issues when setting that on the request rather than on the content, so I tried setting the header on the content as already happens for StringContents and that seemed to fix this case - e.g. ad8d2a8

Activity

  1. Numpsy commented on Feb 15, 2026

    @Numpsy
    ContributorAuthor

    Should be fixed by #292

  2. sergey-tihon commented on Feb 15, 2026

    @sergey-tihon
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions