-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with GetMethod with Body request - RestSharp (DotnetCore 2.2) #1405
Comments
There are quite a few issues with your code, I repeatedly see the same mistake being made by developers using RestSharp:
All of it is described in the documentation https://restsharp.dev/usage/parameters.html#addjsonbody Concerning GET requests with body - it never actually worked. Previously we were ignoring body parameters for GET requests, now we started to throw. We had several issues discussing it, like #1330. The reason for RestSharp not to support body for GET requests is that Currently, RestSharp uses |
Thank you @alexeyzimarev for the comments; awaiting for the version with HttpClient implemented. |
I am going to close it, it should be auto-resolved by the HttpClient implementation. Until then, we will throw an exception when people try using GET with a body. |
When planned? |
This is a continuation of issue #1399
I followed the suggestions recommended by you with "proper typed object as a parameter" with the same issue that
{"errors":{"":["A non-empty request body is required."]},"title":"One or more validation errors occurred.","status":400,"traceId":"0HLSKFCCSHR42:00000001"}
Interestingly when i updated RestSharp to 16.10.1, i am getting a different message the GET method does not support body.
var request1 = new RestRequest(Method.GET);
request1.AddHeader("Content-Type", "application/json");
request1.AddHeader("Authorization", "Bearer 111");
var test = new SearchRequest()
{
ABC= "1253",
EFG = "5254",
Name = new SearchRequestName()
{
Title = "",
Forename = "",
Mid_Initial = "",
Surname = "",
Suffix = ""
},
Dob = "",
Address = new SearchRequestAddress()
{
Sub_Bld_Name = "",
House_Name = "",
House_Nb = "",
Street = "",
District = "",
Town = "",
County = "",
Postcode = ""
}
};
response = apiService.Execute(request);
Could you please help us here.
To my understanding Resharp support "httpclient", please correct me if i am wrong.
Your assistance would be appreciated.
The text was updated successfully, but these errors were encountered: