I've seen various answers to this question in C# but I'm baffled why the same solution doesn't seem to work in F#.
let client = new HttpClient();
let msg = new HttpRequestMessage(HttpMethod.Post, "http://localhost:9999/")
msg.Version <- System.Net.HttpVersion.Version10
let body = System.Text.Encoding.ASCII.GetBytes("HTTP MESSAGE")
msg.Content <- new ByteArrayContent(body)
let task = Async.AwaitTask (client.SendAsync(msg))
At first I thought the issue was related to the HTTP 1.1 expect-100 behavior which the server side doesn't support it. But after changing to HTTP 1.0 this is what the client actually sends:
POST / HTTP/1.0
And that's it. It's still not sending the HttpRequestMessage.Content. What am I missing here?