简体   繁体   中英

How can I the see actual raw request that gets sent

In order to see the raw response I use the OnBeforeDeserialization event but I want to see the raw request because I am getting errors and I want to know exactly what is being sent.
Is there any way to do this without using the restsharp source code and debugging it?
Thank you

Edit 1:
Managed to catch traffic with fiddler: this is the TextView of the request:

assignee=test&milestone=0&state=open&title=test%20issue&body=test%20issue

This is the response:

{"message":"Problems parsing JSON"}

This is how I configure my request:

var request = new RestRequest();

    request.Resource = "repos/" + repo_slug + "/issues";
    request.Method = Method.POST;
    request.OnBeforeDeserialization = resp => { cnt = resp.Content; };
    // Convert Issue:
    GitModels.IssuePost toPostIssue = Git2Bit.GitModels.Bit2GitTranslator.translate(bitIssue);

    request.AddParameter("assignee", toPostIssue.assignee, ParameterType.GetOrPost);
    request.AddParameter("milestone", toPostIssue.milestone, ParameterType.GetOrPost);

    request.AddParameter("state", toPostIssue.state, ParameterType.GetOrPost);

    request.AddParameter("body", toPostIssue.body, ParameterType.GetOrPost);

Getting issues instead of posting works.:|

Well fiddler did the trick don't know why it didn't work the first time.
As for posting issues on github I had to send my request in JSON format like this:

request.RequestFormat = DataFormat.Json;
request.AddHeader("Accept", "application/json");
request.OnBeforeDeserialization = resp => { cnt = resp.Content; };

GitModels.IssuePost toPostIssue = Git2Bit.GitModels.Bit2GitTranslator.translate(bitIssue);

request.AddBody(toPostIssue);

basically I had to set the proper requestformat and add to the body of the request instead of having to add parameters

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM