Converting Composed Fiddler Everywhere Requests to cURL

Environment

Product
Product Version 1.0.0 and above
3rd-party tool cURL
Supported OS macOS, Linux, Windows

Description

Many developers, support engineers, and end-users are familiar with the cURL as a fast tool for executing and managing requests. How can I easily convert a request that was generated in the Composer to a cURL script?

Solution

Fiddler Everywhere version 4.0.0 and above provides an automated export as cURL script through the Live Traffic grid context menu.

To export a session as cURL:

  • Select the captured session.

  • Open the context menu and choose Copy > Copy as cURL

Copy as Curl

Solution (Obsolete)

The Composer provides options for creating and executing your requests. Each executed request is added to the Live Traffic grid as a new session entry.

To convert a request created in the Composer:

  1. Create and execute your request in the Composer.
  2. Open the Live Traffic grid and select the generated session from the executed request above.
  3. Open the context menu by right-clicking the session entry and go to Export > Selected Sessions.
  4. From the drop-down menu, choose cURL Script and click Next.
  5. Choose a name and extension for the file. Click Save. By default, the file name is the current date and the extension is BAT.

By default, Fiddler Everywhere saves the outputted cURL script as a BAT file, which is appropriate for Windows usage. Linux and macOS users might want to change the default extension with the proper format for the OS—for example, to *.sh for the Shell script.

A cURL output generated from Fiddler Everywhere looks similar to the following sample:

curl -k -i --raw -o 0.dat "http://httpbin.org/get?theAnswer=42" -H "User-Agent: Fiddler Everywhere" -H "Host: httpbin.org"
  • The -k flag allows insecure server connections when using SSL. Fiddler Everywhere adds the flag to ensure that the cURL script can be executed even with the Fiddler proxy and its certificate in place.
  • Fiddler Everywhere internally uses the -o <x>.dat to generate different DAT files for each selected session.
  • Fiddler Everywhere adds the User-Agent header automatically for all requests made with the Composer.

You are free to modify, remove and change the generated flags and parameters as per your technical requirements.