Follow the code below:
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
var result = await httpClient.DeleteAsync(new Uri("URL do Site ..."));
See the return:
HTTP Status 415 - Unsupported Media Type Type Status Report
Message Can not consume content type
Description The origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource.
Apache Tomcat / 8.5.23
I put "Accept", "application/json"
and it still did not work. I seem to be missing application/json
no DeleteAsync()
.
Any solution?