gpt4 book ai didi

c# - 我如何找到 RestSharp PUT 抛出异常的原因?

转载 作者:行者123 更新时间:2023-11-30 23:21:55 25 4
gpt4 key购买 nike

我已经发送了一个PUT请求并得到 NullReferenceExceptionRestSharp.Portable :

using (var client = new RestClient(new Uri(BaseUri)))
{
var oAuth1Authenticator = OAuth1Authenticator.ForAccessToken(
OAuthConsumerKey,
OAuthConsumerSecret,
oAuthToken",
oAuthSecret"
);

client.Authenticator = oAuth1Authenticator;

var request = new RestRequest(lastPartUri, httpMethod);

request.AddJsonBody(body);

IRestResponse response = await client.Execute(request);

return response.Content;
}

专线IRestResponse response = await client.Execute(request);抛出异常。

OAuth 参数绝对不是 null , 也不是 BaseUrilastPartUri . bodyDictionary<string, string>并且也不为空。

POSTGET具有相同参数的请求工作得很好。

看起来问题出在 RestSharp 中图书馆。我怎样才能找到它?

这是堆栈跟踪:

   at RestSharp.Portable.Authenticators.OAuth1Authenticator.<>c.<AddOAuthData>b__84_3(Parameter p)
at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
at RestSharp.Portable.Authenticators.OAuth1Authenticator.AddOAuthData(IRestClient client, IRestRequest request, OAuthWorkflow workflow)
at RestSharp.Portable.Authenticators.OAuth1Authenticator.PreAuthenticate(IRestClient client, IRestRequest request, ICredentials credentials)
at RestSharp.Portable.RestClientBase.<ExecuteRequest>d__67.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at RestSharp.Portable.HttpClient.RestClient.<Execute>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Store.Helpers.MyBookApiConnector.<SendRequest>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Store.Services.DataService.<UpdateReview>d__80.MoveNext()

Before exception After exception

最佳答案

这确实是库中的错误。开发人员已经修复。

关于c# - 我如何找到 RestSharp PUT 抛出异常的原因?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39036762/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com