Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4062

How to get http client to handle response for http method delete and body

$
0
0

.NET is not happy with DELETE requests that use body content. With the API I'm integrating with, the request looked like it was being sent but the response always timed out. This occurred both with WebClient and HttpClient. The API developers see the request on their end and respond with 200 but HttpClient doesn't get the response and timesout. Their API def works because I've hit it with postman and other request tools.

I tried adding various request/response headers. Using both HttpClient and WebRequest directly. I would expect any response from the API.

DeleteWithPostAsync(string url, string json){   HttpRequestMessage request = new    HttpRequestMessage(HttpMethod.Delete, url)   {    Content = new StringContent(json, Encoding.UTF8, "application/json"),   }; var result = await  client.SendAsync(request).ConfigureAwait(false); var response = await  result.Content.ReadAsStringAsync().ConfigureAwait(false); return response;}

Viewing all articles
Browse latest Browse all 4062

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>