Closed
Description
API Approval - iteration 2
This is being submitted again for approval because we decided additional APIs were needed.
Copied from proposal in #17036 (comment)
public class StringContent
{
public StringContent(string content);
+ public StringContent(string content, MediaTypeHeaderValue mediaType); // Already approved in iteration 1
public StringContent(string content, Encoding encoding);
public StringContent(string content, Encoding encoding);
public StringContent(string content, Encoding encoding, string mediaType);
+ public StringContent(string content, Encoding encoding, MediaTypeHeaderValue mediaType); // NEW API proposal
}
public class MediaTypeHeaderValue
{
public MediaTypeHeaderValue(string mediaType)
+ public MediaTypeHeaderValue(string mediaType, string charSet); // NEW API proposal
}
Previous API approval is here: #17036 (comment)
Original post
Consider the following code ...
string contentType = "application/atom+xml";
string requestPayload = "some data";
var stringContent = new StringContent(requestPayload, Encoding.UTF8, contentType);
According to Wireshark, I'm seeing a POST using HttpClient
with this ...
Content-Type: application/atom+xml; charset=utf-8
Shouldn't that Content-Type
value just be ...
Content-Type: application/atom+xml
?? Confused, because something is choking my Azure Table Storage requests with ...
string stringToSign =
$"{requestMethod}\n\n{contentType}\n{dateInRfc1123Format}\n{canonicalizedResource}";
... and since SharedKeyLite
, which only requires the date and resource, works with my dateInRfc1123Format
and canonicalizedResource
, I've sort of narrowed it down to the contentType
of the request (shown above) not matching what I'm putting into the signature sting, namely just application/atom+xml
.