Wednesday, December 21, 2016

Export to cURL from Fiddler

As a long-time user of Fiddler to monitor request traffic. It would be nice to export a request as a cURL command. Easy to save, easy to pass around.  Follow instructions here to add Copy as cURL command to your context options:

Click Rules > Customize Rules (Ctrl+R) and type this right before the closing curly bracket (})

BindUIButton("Copy cURL")
ContextAction("Copy cURL")
public static function doCopyCurl(arrSess: Session[])
{
var oExportOptions = FiddlerObject.createDictionary();
// If you'd prefer to save to a file, set the Filename instead
//oExportOptions.Add("Filename", "C:\\users\\lawrence\\desktop\\out1.bat");
oExportOptions.Add("ExportToString", "true");
  FiddlerApplication.DoExport("cURL Script", arrSess, oExportOptions, null);
var sOutput: String = oExportOptions["OutputAsString"];

Utilities.CopyToClipboard(sOutput);
FiddlerApplication.UI.SetStatusText("Copied Sessions as HAR");
}

code from https://textslashplain.com/2015/12/30/whats-new-in-fiddler-4-6-2/

No comments: