Last active
July 26, 2024 18:59
-
-
Save manifestinteractive/ce8dec10dcb4725b8513 to your computer and use it in GitHub Desktop.
A friendly formatter for curl requests to help with debugging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \n | |
| ============= HOST: ==========\n | |
| \n | |
| local_ip: %{local_ip}\n | |
| local_port: %{local_port}\n | |
| remote_ip: %{remote_ip}\n | |
| remote_port: %{remote_port}\n | |
| \n | |
| ======= CONNECTION: ==========\n | |
| \n | |
| http_version: %{http_version}\n | |
| http_code: %{http_code}\n | |
| http_connect: %{http_connect}\n | |
| num_connects: %{num_connects}\n | |
| num_redirects: %{num_redirects}\n | |
| redirect_url: %{redirect_url}\n | |
| \n | |
| ============= FILE: ==========\n | |
| \n | |
| content_type: %{content_type}\n | |
| filename_effective: %{filename_effective}\n | |
| ftp_entry_path: %{ftp_entry_path}\n | |
| size_download: %{size_download}\n | |
| size_header: %{size_header}\n | |
| size_request: %{size_request}\n | |
| size_upload: %{size_upload}\n | |
| speed_download: %{speed_download}\n | |
| speed_upload: %{speed_upload}\n | |
| ssl_verify_result: %{ssl_verify_result}\n | |
| url_effective: %{url_effective}\n | |
| \n | |
| === TIME BREAKDOWN: ==========\n | |
| \n | |
| time_appconnect: %{time_appconnect}\n | |
| time_connect: %{time_connect}\n | |
| time_namelookup: %{time_namelookup}\n | |
| time_pretransfer: %{time_pretransfer}\n | |
| time_redirect: %{time_redirect}\n | |
| time_starttransfer: %{time_starttransfer}\n | |
| ----------\n | |
| time_total: %{time_total}\n | |
| \n |
Only piece missing is:
"http_version": "%{http_version}",\n
Also, filename_effective will always be /dev/null if you don't use -O, --remote-name and --remote-name-header.
won't num_redirects always be zero since you don't pass the -L parameter to curl? and if you do use -L, wouldn't that mess up the timings since you then have multiple requests?
Hi, do you mind explanning why total time is not the sum of all other values?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to Use:
#1. Make a file named
sniff.txtand paste the contents of this gist into it#2. Make an alias in your
.bash_profileor.zshrc( or whatever you use ) that looks like this ( make sure tosource .bash_profilethe file afterwards ):#3. Now you can use your alias to get some fun data back:
sniff https://api.twitter.com/1.1/search/tweets.json?q=@mrmidiYou will get a response that looks like this: