-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I have the following API-method:
[Route("api/xyz")]
[HttpPost]
public IHttpActionResult PostAPIXYZ() {
return Ok("ok");
}Then calling it with:
using PainlessHttp.Http;
var config = new Configuration {
BaseUrl = "http://localhost:81",
};
HttpClient = new HttpClient(config);
var result = HttpClient.PostAsync<MyResult>("api/xyz", null).Result;Result: Http status: LengthRequired (411)
In powershell it works ok:
> (Invoke-WebRequest http://localhost:81/api/xyz -Method POST).StatusDescription
OKUsing Http client from System.Net.Http works ok:
using System.Net.Http;
HttpClient HttpClient = new HttpClient {
BaseAddress = new Uri(http://localhost:81),
};
var result = HttpClient.PostAsync("api/xyz", new StringContent(""))Metadata
Metadata
Assignees
Labels
No labels