I am trying to do send a delete request to webapi with a json content. I searched and the result is that Httpclient.DeleteAsync method cant be used with content so i have to use Httpclient.SendAsync. But i couldnt manage to success that. I always keeping to take 400 statusCoded error. My Code is;
   public async Task<TResponse> DeleteWithContent(string requestPath, string jsonContent, string token)
    {
        using (var client = new HttpClient())
        {
            client.BaseAddress = new Uri(_apiUrl);
            client.DefaultRequestHeaders.Accept.Clear();
            var contentType = new MediaTypeWithQualityHeaderValue("application/json");
            client.DefaultRequestHeaders.Accept.Add(contentType);
            if (!string.IsNullOrEmpty(token))
            {
                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
            }
            var httpContent = new StringContent(jsonContent, Encoding.UTF8, "application/json");
            var request = new HttpRequestMessage(HttpMethod.Delete, client.BaseAddress);
            request.Content = httpContent;
           var response1= client.SendAsync(request).Result;
            var readed = response1.Content.ReadAsStringAsync();
            return JsonConvert.DeserializeObject<TResponse>(response1.ToString());
        }
    }
Please help!!
