有没有办法在RestSharp中获取已发送请求的整个CURL字符串表示形式,包括消息正文? 为了进行测试,我需要使用它来概述已发送的请求。
对于此请求:
restClient = new RestClient("http://some.domain.com");
restClient.token = token;
var request = new RestRequest("/api/Endpoint", Method.POST);
request.AddQueryParameter("id", HttpUtility.UrlEncode(configuration["ID"]));
request.AddJsonBody("{ \"name\": \"string\" }")
我想得到这种表示形式:
curl -X POST "https://some.domain.com/api/Endpoint?id=1" -H "accept: text/plain" -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6Ijc2MGM5MGNlLWQ1NDQtNDNkMi1iZTZlLWVlODgyODY0NWYyMCIsIm5iZiI6MTU2MjkxOTg1MSwiZXhwIjoxNTYyOTYzMDUxLCJpYXQiOjE1NjI5MTk4NTF9._sTBXUcqSzjdrIHSYbRqyt_YsvCHvYIllYAcM_NOvdc" -H "Content-Type: application/json-patch+json" -d "{ \"name\": \"string\" }"