-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get actual raw request/response #885
Comments
This would be really valuable. |
Is it still not availiable? |
Please make it, so simple... |
@vk5880 if it is so simple, why won't you make it? I will happily accept your PR. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Btw, |
@alexeyzimarev - not the case for request.RawBytes though |
@alexeyzimarev those |
ok, so it's about the request, right? how deserialisation applies to the request? requests don't get deserialised, it's the opposite. |
@alexeyzimarev Oh okay thanks for your answer, I tried to deserialize before using |
I am not sure why would you are trying to do. Deserialise to a string? The content is already a string, what’s there to deserialise? |
@alexeyzimarev For example, the content I requested was returned as |
You can just unescape the string instead. |
@alexeyzimarev that's kind of what I'm trying to achieve yes, but don't know of any other way. |
This comment has been minimized.
This comment has been minimized.
@softlion if it's "unacceptable", I would suggest opening a pull request to make it happen. Easy, right? "Contributions for an easier world"... |
This comment has been minimized.
This comment has been minimized.
Of course you did. That's how ".NET community" contributes in general, I assume. |
I'm curious @alexeyzimarev (I don't use RestSharp), can this framework accept custom Delegating Handlers? It seems like any sort of middleware between the HttpClient and RestSharp should be able to capture the details requested by the OP. |
@ChaseFlorell thanks, it looks great! Basically, the most obvious issue was always that RestSharp used the legacy But this particular issue is weird as RestSharp was never composing raw request bytes, it was (and is) using what .NET provides for making HTTP calls. As long as you know how to observe HTTP calls, you should be good. Your library is trivial to connect to v107 I would assume. |
Ok, to make things even simpler I added an option to configure the handler for the case when one is not creating the handler themselves. That's how it can be used: public MultipartFormDataTests(ITestOutputHelper output) {
_output = output;
_server = SimpleServer.Create(RequestHandler.Handle);
var options = new RestClientOptions(_server.Url) {
ConfigureMessageHandler = handler => new HttpTracerHandler(handler, new OutputLogger(output), HttpMessageParts.All)
};
_client = new RestClient(options);
} I added to one of the tests and it works great. Thanks again @ChaseFlorell :) |
How to do this with the .net core ILogger interface. Where does the output go? |
It's the Xunit test output. |
Hello,
I want to log actual http raw request/response that have been sent out to minimize troubleshooting time. Is there a way to do that?
The text was updated successfully, but these errors were encountered: