我想获得我将要使用HttpRequestMessage发送的HTTP请求的“字符串”版本。有没有一种简单的方法可以做到这一点,还是我需要自己生成类似的东西?
HttpRequestMessage request = new HttpRequestMessage();
request.ToString();
得到这样的东西:
GET https://test.com/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json
Authorization: Basic Yasjkdhaksjdhakjdhak==
Host: test.com
Connection: Keep-Alive
Content-Length: 0