In a previous version of RestSharp I was able to add a content-type:application/json
RestClientOptions options = new RestClientOptions();
options.BaseUrl = new Uri($"https://{_options.Auth0Domain}");
var client = new RestClient(options);
var request = new RestRequest("/oauth/token") { Method = Method.Post };
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", json, ParameterType.RequestBody);
var response = await client.ExecuteAsync<Auth0MachineToMachineResponse>(request);
But after the big 107 release I get this error when I try to add the content-type, which is required by the end point I am calling:
"Misused header name, 'content-type'. Make sure request headers are used with HttpRequestMessage
Try with:
request.AddParameter("Content-Type", "application/x-www-form-urlencoded", ParameterType.HttpHeader);
It seems is case sensitive now?