Skip to content
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

RestRequest post fails v-112. wehre as same is working on 106. #2259

Open
bindukumari638 opened this issue Sep 6, 2024 · 1 comment
Open

Comments

@bindukumari638
Copy link

Remove all the text above the next line when submitting your issue.

Describe the bug
We have upgraded rest sharp to latest stable version 112 and try to generate token through an API by passing client id and secret It is failing. However, if we try to generate similar token using older version of Rest Sharp API(106), works perfectly fine. What change, I need to do in my code snippet to suit the call

To Reproduce
var request = new RestRequest();// new RestRequest("api/attachments", Method.Post);
request.Method = Method.POST;
request.Timeout = 800000;//new TimeSpan(800000);
// request.ReadWriteTimeout = 800000;
request.AddHeader("User-Agent", "Mozilla/5.0");
request.AddHeader("Charset", "utf-8");
request.AddHeader("Content-Type", "application/json");
JObject jbody = new JObject();
jbody.Add("client_id", client_id);
jbody.Add("client_secret", client_secret);
jbody.Add("grant_type", "client_credentials");

request.AddParameter("application/json", jbody, ParameterType.RequestBody);

IRestResponse response = client.Execute(request);

Expected behavior
API should return a value which is used a token

Stack trace
No exception. Response Status code is 0

Desktop (please complete the following information):

  • OS: [e.g. macOS]
  • .NET version [e.g. .NET 6]-NET 8
  • Rest Sharp Version [e.g. 112.0.0]

Additional context
Add any other context about the problem here.

@alexeyzimarev
Copy link
Member

I can only suggest to read the documentation.

@alexeyzimarev alexeyzimarev removed the bug label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants