I just upgraded my RestSharp client from 106.15.0 to 110.2.0. I have been modifying my code to accommodate the breaking changes.
I am now creating and posting my request as follows:
var payload = JsonConvert.SerializeObject(tokenRequest, JsonSerializerSettings);
var request = new RestRequest(route);
request.AddHeader("ContentType", "application/json");
request.AddStringBody(payload, DataFormat.Json);
var response = restClient.Post(request);
This works correctly, but if I examine the request.Parameters, the payload is in an unnamed parameter.
However, if I change request.AddStringBody(payload, DataFormat.Json) to request.AddParameter(nameof(payload), payload), I can use the request.Parameters.TryFind("payload") method to retrieve the payload, but then when I call restClient.Post(request) it throws a "BadRequest" exception.
What am I doing wrong?