I'm using the Microsoft.Net.Http package in Xamarin Forms PCL. It is sending the request, but it isn't sending it as "applicaiton/json" it's sending it as "text/html" still. I've looked online and I haven't found anything that works. I did find PostAsJsonAsync, but Xamarin tells me this method isn't found. Anyone have any idea how to make this work?
My code:
`string sData = Newtonsoft.Json.JsonConvert.SerializeObject(myObject);
HttpContent content = new System.Net.Http.StringContent(sData, System.Text.Encoding.UTF8, "application/json");
client.BaseAddress = new Uri("http://mysite.com/api/v1/");
var response = await client.PostAsync("my_page", content);
var responseJson = response.Content.ReadAsStringAsync().Result;`
As @MihaMarkic pointed out, I didn't explain the situation very well. I've edited my description to have more info.