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

.NET 8 RestApi Request ContentType becomes null

$
0
0

When I add ContentType header to request it becomes null instead of application/json. I can see it in the debugger. Here is the code

RestClient client = new RestClient(url);client.Timeout = -1;RestRequest request = new RestRequest(Method.POST);request.AddHeader("Authorization", "Bearer " + token);request.AddHeader("Content-Type", "application/json");request.AddParameter("application/json", requestBody, ParameterType.RequestBody);IRestResponse<T> response = await client.ExecuteAsync<T>(request);

Debugger Image

Any suggestions ? Thanks in advance

I tried changing the "Content-Type" to "ContentType" but that doesn't work


Viewing all articles
Browse latest Browse all 4140

Latest Images

Trending Articles



Latest Images

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