【问题标题】:How to handle custom http error code in RestSharp .NET如何在 RestSharp .NET 中处理自定义 http 错误代码
【发布时间】:2021-07-27 12:06:20
【问题描述】:

RestSharp中如何处理自定义HTTP错误代码,IRestResponse.HttpStatusCode不允许处理599或其他自定义代码,有什么办法处理吗?请帮忙

我们有一个特定的情况,我们在 HttpStatusCode 中得到 599

【问题讨论】:

    标签: c# http restsharp webapi http-error


    【解决方案1】:

    检查这个response

    RestResponse response = client.Execute(request);
    HttpStatusCode statusCode = response.StatusCode;
    int numericStatusCode = (int)statusCode;
    

    【讨论】:

      猜你喜欢
      • 2015-10-09
      • 1970-01-01
      • 2019-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多