Skip to content

What kind of media type does StringContent constructor support? #4487

@chucklu

Description

@chucklu

StringContent(String, Encoding, String)
The third parameter is mediaType String
The media type to use for the content.

When I pass "application/base64" as the mediaType, I got the following error message.

new StringContent(fileContent, Encoding.UTF8, "application/base64")

The best overloaded method match for 'System.Net.Http.StringContent.StringContent(string, System.Text.Encoding, string)' has some invalid arguments
ExceptionType:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException
Assembly:Anonymously Hosted DynamicMethods Assembly
Method:System.Net.Http.StringContent CallSite.Target(System.Runtime.CompilerServices.Closure, System.Runtime.CompilerServices.CallSite, System.Type, System.Object, System.Text.Encoding, System.String)

I find the media type from this page.
I am not sure if this class can support all media types.
I wonder if you guys can list how many media types are supported for StringContent's constructor.

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