Won't Fix
Last Updated: 06 Nov 2020 17:51 by Eric
a
Created on: 03 Nov 2020 02:19
Type: Feature Request
1
How can I log request in Composer? (What method can be used to log request in code?)

我想修改一下Composer的功能,

请问Eric:

1. 在代码里Fiddler有什么方法可以把发送的请求信息记录到Composer History列表?(重点

2. 点击Excute按钮,是怎么把请求记录下来的?记录的请求保存在什么位置?

期待Eric的答案。

3 comments
Eric
Posted on: 06 Nov 2020 17:51

Extending the Composer's request history list is not supported.

You can, however, drag/drop sessions to the Composer from either the Web Sessions list or a Session Clipboard (extension) or any extension you like. 

ADMIN
Nick Iliev
Posted on: 03 Nov 2020 11:07

Hi there,

 

Apart from what Eric could suggest here, I want to mention that a similar topic and different solutions for outputting the requests are offered here (still, this is not happening within the Composer UI).

 

As a side note, I want to note that the new Fiddler Everywhere comes with built-in functionality for creating and saving Composer requests for later reuse, modification, and sharing.

 

Regards,
Nick Iliev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

a
Posted on: 03 Nov 2020 06:20

Eric,代码里我已经把请求信息添加到Composer的History里,并且把session也赋值到listViewItem的Tag中,但是双击这条请求时会引发异常:

以下是我的部分代码:

//记录请求历史
StringBuilder stringBuilder = new StringBuilder(1024);
stringBuilder.AppendFormat("{0} {1} {2}\r\n", requestMethod, requestURL, cbxBuilderHTTPVersion.Text);
stringBuilder.Append(requestHeaderTextBox.Text.Trim());
stringBuilder.Append("\r\n\r\n");
HTTPRequestHeaders hTTPRequestHeaders = Parser.ParseRequest(stringBuilder.ToString());
Uri uri = new Uri(requestURL);
string lower = uri.Host;
hTTPRequestHeaders["Host"] = lower;
requestHeaderTextBox.Text = hTTPRequestHeaders.ToString(false, false);
Encoding entityBodyEncoding = Utilities.getEntityBodyEncoding(hTTPRequestHeaders, null);
Session session = new Session(hTTPRequestHeaders, entityBodyEncoding.GetBytes(requestBodyTextBox.Text));
session.UNSTABLE_SetBitFlag(SessionFlags.RequestGeneratedByFiddler, true);
session.oFlags["x-From-Builder"] = "Parsed";
session.responseBodyBytes = null;
session.oResponse = null;

int num = 0;
string requestMethod = oS.RequestMethod;
if (requestMethod == "GET")
{
    num = 0;
}
else if (requestMethod == "POST")
{
    num = 1;
}
else
{
    num = (requestMethod == "OPTIONS" || requestMethod == "HEAD" ? 2 : 3);
}
string item = oS.oFlags["ui-comments"];
if (!Utilities.IsCommentUserSupplied(item))
{
    item = oS.url;
}
Fiddler.DoubleBufferedListView doubleBufferedListView = (Fiddler.DoubleBufferedListView)FiddlerApplication.UI.pageBuilder.Controls["UIComposer"].Controls["tabsBuilder"].Controls["pageParsed"].Controls["splitOutside"].Controls[1].Controls[0].Controls["lvHistory"];
ListViewItem listViewItem = doubleBufferedListView.Items.Insert(0, item, num);
string str = Utilities.IsNullOrEmpty(oS.requestBodyBytes) ? string.Empty : string.Format("\n{0} body bytes", oS.requestBodyBytes.Length);
listViewItem.ToolTipText = string.Format("{0}\n{1}{2}", oS.RequestMethod, oS.fullUrl, str);
listViewItem.Tag = new Session(oS);

 

请帮忙解决一下,谢谢~

Fiddler Info:

Progress Telerik Fiddler Web Debugger

v5.0.20202.18177 for .NET 4.6.1
Built: 2020年4月14日

64-bit AMD64, VM: 135.0mb, WS: 196.0mb
.NET 4.7.2 WinNT 10.0.17763.0

You've run Progress Telerik Fiddler: 2,590 times.

Running on: xxxx:8888
Listening to: All Adapters
Gateway: Auto-Config
Config script: http://127.0.0.1:61398

Copyright ©2003-2020 Progress Software Corporation. All rights reserved.