I'm new to F# and I'm trying understand how to make a POST request with HttpClient. I can make a GET request like this
let getAsync (url:string) =
async {
let httpClient = new System.Net.Http.HttpClient()
let! response = httpClient.GetAsync(url) |> Async.AwaitTask
response.EnsureSuccessStatusCode () |> ignore
let! content = response.Content.ReadAsStringAsync() |> Async.AwaitTask
return content
}
getAsync "www.example.com/action"
|> Async.RunSynchronously
|> printfn "%s"
Now I want to make a POST request with a body containing a simple key value pair (lets say genre : 1). I can create a FormUrlEncodedContent but it takes a KeyValuePair. So also what is the kvp equivalent in F# ?