Search code examples
javahttpconvertersfiddler

Convert captured Fiddler requests to Java


I was wondering, what is the easiest way to convert a request captured by Fiddler to Java code? For example, Fiddler captures a request, and I'm wondering if there is an easy way to turn it into Java code so that I can send the same request programmatically!

I am open to suggestions of other Chrome plugins that would work for this!


Solution

  • You have the possibility of:

    • Selecting all desired requests
    • Open a contextual menu
    • Choose "Save" and save them to a file. Then, you can just read the file and use Apache HttpClient (one option out of thousands) to build the different types of requests (GET,POST,etc) to the hosts specified in the saved file.

    For instance, this is a POST request sent to SO while I was writing this answer:

    POST http://stackoverflow.com/posts/validate-body HTTP/1.1
    Host: stackoverflow.com
    Connection: keep-alive
    Content-Length: 332
    Accept: */*
    Origin: http://stackoverflow.com
    X-Requested-With: XMLHttpRequest
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36
    Content-Type: application/x-www-form-urlencoded
    Referer: http://stackoverflow.com/questions/31931998/convert-captured-    fiddler-requests-to-java
    Accept-Encoding: gzip, deflate
    Accept-Language: es,de-DE;q=0.8,de;q=0.6,en-US;q=0.4,en;q=0.2
    Cookie: <<ommitted>> 
    body=You+have+the+possibility+of+selecting+...