Skip to content

A simple utility to convert a curl request to tsung's xml request

License

Notifications You must be signed in to change notification settings

perfectayush/curl2tsung

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

curl2tsung

A simple utility to convert a curl request to tsung's xml request. Useful for quickly generating tsung's xml conf rather than typing xml yourself.

Firefox and Chrome support copying an http request as curl command from the web developer tools. You can use that feature to copy a request as curl and then replace curl with curl2tsung script. It currently supports only the most common curl options I encountered while dealing curl commands generated with firefox and chrome developer tools.

Usage

A request to github.com, 'copied as curl' from chrome developer tools looks like this

curl 'https://github.com/' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Connection: keep-alive' -H 'Accept-Encoding: gzip, deflate, sdch, br' -H 'Accept-Language: en-US,en;q=0.8' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36' --compressed

Replacing curl with curl2tsung utility generates following output:

<request>
  <http method="GET" url="https://github.com/" version="1.1">
    <http_header name="Accept-Language" value="en-US,en;q=0.8"/>
    <http_header name="Accept-Encoding" value="gzip, deflate, sdch, br"/>
    <http_header name="Accept" value="text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"/>
    <http_header name="User-Agent" value="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36"/>
    <http_header name="Connection" value="keep-alive"/>
    <http_header name="Upgrade-Insecure-Requests" value="1"/>
  </http>
</request>

About

A simple utility to convert a curl request to tsung's xml request

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages