StringContent - mediaType Parameter
c#, httpclient
Solution
Wow, yeah the msdn documentation for that class needs some work.
When you create a new instance of `StringContent`, it always sets a media type. If you don't specify one, it uses "text/plain"; otherwise, it uses whatever you passed in. (There appears to be some validation done on the value you pass in, but I don't really understand what it's doing.)
That media type value is then used to instantiate a new `MediaTypeHeaderValue`, which is assigned to your StringContent's `Headers.ContentType` property.
From the documentation for Headers:
Gets the HTTP content headers as defined in RFC 2616.
The comment on the Content-Type property:
The value of the Content-Type content header on an HTTP response.
So all that to say, it's apparently specifying the HTTP content type.
Here's a full list of types, which is too long to include here. I'm sure there's a list somewhere on MSDN too but I couldn't find one.
Problem
Does anyone have any idea what the 'mediaType' parameter does for the `StringContent`'s constructor? Nothing is listed on its MSDN page.