0

我在 post 方法中使用参数,例如:

https://localhost:44345/example?id=123&value=123&anotherValue=123

但是,我不想在标头中显示参数,如何将这些作为 json 在正文中发送,例如:

{
    "id": "123",
    "value": "123",
    "anotherValue": "123"
}

如果有人已经问过这个,请告诉我,谢谢。

4

1 回答 1

0

您可以使用该AddJsonBody方法。RestSharp 官方文档中有一个示例:https ://restsharp.dev/usage/parameters.html#addjsonbody

使用(第三方)库时的一般建议是阅读文档。

于 2020-10-28T20:18:21.453 回答