Completed
Last Updated: 04 Nov 2021 13:22 by Dan
Imported User
Created on: 03 Mar 2017 04:04
Type: Feature Request
7
Add "copy as curl" to the list of right-click options
This is a feature that's present in both the Firefox and Chrome dev tools, and it's incredibly useful. Fiddler is already great, and that would make it so much better :-)
3 comments
Dan
Posted on: 04 Nov 2021 13:22

The options the developers chose for cURL DoExport are hardcoded into Fiddler's DLL. If you need a different set of options, a quick hack is to use sOutput.Replace:


    BindUIButton("Copy cURL")
    ContextAction("Copy cURL")
    
    public static function doCopyCurl(arrSess: Session[])
    {
        var oExportOptions = FiddlerObject.createDictionary();

        oExportOptions.Add("ExportToString", "true");

        FiddlerApplication.DoExport("cURL Script", arrSess, oExportOptions, null);
        var sOutput: String = oExportOptions["OutputAsString"];
        
        sOutput = sOutput.Replace("-i --raw -o 0.dat","-L -vvv --compressed")

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

 

Dan
Posted on: 11 Feb 2020 20:33

Hello Eric,

Thank you very much for responding to this suggestion.

I'm trying to make Copy as cURL include POST paramter data and to remove the "-i --raw" curl options from the resulting final curl string, but this behavior seems to be hard-coded. Is there a way to make this happen using oExportOptions in doCopyCurl?

Eric
Posted on: 03 Mar 2017 06:00
https://textslashplain.com/2015/12/30/whats-new-in-fiddler-4-6-2/ contains a script that adds a Copy cURL command to the Session's context menu.