简体   繁体   English

如何在 C# 中使用 Titanium Web 代理获取请求有效负载?

[英]How to get request payload using Titanium Web Proxy in C#?

I'm using Titanium Web proxy to monitor requests and responses but I can't find out how get the payload data of requests.我正在使用 Titanium Web 代理来监视请求和响应,但我不知道如何获取请求的有效负载数据。 Here is my function that takes the request object and pulls the data I need from it.这是我的函数,它接受请求对象并从中提取我需要的数据。

    public async Task OnRequest(object sender, SessionEventArgs e)
    {
        string requestBodySent = e.HttpClient.Request.HasBody ? e.HttpClient.Request.BodyString : null;
        CustomRequests requestSent = new CustomRequests(e.HttpClient.Request.Method, e.HttpClient.Request.HeaderText, requestBodySent, e.HttpClient.Request.RequestUri);

        requestHistory.Add(requestSent);
    }

I'm able to pull and save the body, method type, headers, and url but I don't know how to get the payload data being sent out like when I'm logging into an account and submit the login form.我可以拉取并保存正文、方法类型、标题和 url,但我不知道如何像登录帐户并提交登录表单一样获取发送的有效负载数据。 Any and all help is appreciated, Thanks.任何和所有的帮助表示赞赏,谢谢。

为了获得有效载荷,您应该等待它

var body = await e.GetRequestBodyAsString();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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