RestSharp 107.3.0 - Trouble aligning docs to the real world.

138 views
Skip to first unread message

R.Ax

unread,
May 25, 2022, 5:40:02 PM5/25/22
to RestSharp
I am attempting to rework an existing program using RestSharp previous to the 107 changes.  I'm looking at the documentation specfically for adding data to the body - either AddJsonBody or AddStringBody, but these methods do not appear to exist.  The code looks something like:

var request = new RestSharp.RestRequest($"XX", RestSharp.Method.Patch);
request = RestSharp.RestRequestExtensions.AddHeader(request, "Authorization", $"XX");
request.AddJsonBody(Newtonsoft.Json.JsonConvert.SerializeObject(d));

And I receive a "RestRequest does not contain a definition for 'AddJsonBody'..."

With that being said, it seems most items in the docs aren't applicable for me, for some reason - AddQueryParameter, AddStringBody, AddHeader, etc.

Am I missing something important with the changes in 107?

Thank you.

R.Ax

unread,
May 25, 2022, 5:41:48 PM5/25/22
to RestSharp
This was worded poorly - the existing program is using RestSharp 106.15.0.  The new program is using 107.3.0.

R.Ax

unread,
May 26, 2022, 11:41:22 AM5/26/22
to RestSharp
I can do:

request = RestSharp.RestRequestExtensions.AddBody(request, Newtonsoft.Json.JsonConvert.SerializeObject(d));

Which will not throw an error, but is that the correct way to add a body in 107?

Reply all
Reply to author
Forward
0 new messages