gpt4 book ai didi

c# - 访问来自网络编码性能测试的响应

转载 作者:太空狗 更新时间:2023-10-29 21:54:24 25 4
gpt4 key购买 nike

WebTestRequest request1 = new WebTestRequest((this.Context["Environment"].ToString() + "/IBWeb/DefaultSB.aspx"));
request1.Headers.Add(new WebTestRequestHeader("Referer", (this.Context["Environment"].ToString() + "/IBWeb/")));
ExtractHiddenFields extractionRule1 = new ExtractHiddenFields();
extractionRule1.Required = true;
extractionRule1.HtmlDecode = true;
extractionRule1.ContextParameterName = "1";
request1.ExtractValues += new EventHandler<ExtractionEventArgs>(extractionRule1.Extract);
yield return request1;
request1 = null;

我有一个如上所述的编码网络性能测试。测试运行没有任何问题。但我想访问 WebTestRequest 对象的输出/响应。最好的方法是什么?

最佳答案

添加 PostRequest 事件处理程序

request1.PostRequest += new EventHandler<PostRequestEventArgs>(request1_PostRequest);

处理方法:

void request1_PostRequest(object sender, PostRequestEventArgs e)
{
String responseBody = e.Response.BodyString;
}

关于c# - 访问来自网络编码性能测试的响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18082377/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com