gpt4 book ai didi

c# - Restsharp.RestRequest.RemoveJsonBody() 方法

转载 作者:行者123 更新时间:2023-12-05 02:21:45 24 4
gpt4 key购买 nike

我可以通过这样做添加到 JSON 正文中:

_request.AddJsonBody(obj1);
_request.AddJsonBody(obj2);

我怎样才能清除 body ?没有 RemoveJsonBody() 方法或任何类似的方法。

最佳答案

您可以使用:

_request.Parameters.Clear();

清除请求正文中的所有参数。

_request.Parameters.RemoveAt(1);

删除特定索引处的元素。

你可以尝试一下,只删除 RequestBody 类型并保留标题:

_request.Parameters.RemoveAll(x => x.Type == RestSharp.ParameterType.RequestBody);

关于c# - Restsharp.RestRequest.RemoveJsonBody() 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32219141/

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