Last active
October 16, 2015 21:35
-
-
Save egyptiankarim/1fdc4bb98f60cd420f05 to your computer and use it in GitHub Desktop.
Shortcut for sending HTTP(S) requests from files.
This file contains 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
#!/bin/sh | |
# | |
# Shortcut for sending HTTP(S) requests from files. | |
# | |
# USAGE: | |
# | |
# $ bang [target] [request file] [response file (optional)] | |
usage () { | |
echo "Usage: $ bang [target] [request file] [response file (optional)]\n" | |
exit 1 | |
} | |
if [ "$#" -lt 2 ]; then | |
usage | |
fi | |
if [ "$3" = "" ] ; then | |
< $2 openssl s_client -crlf -quiet -ign_eof -connect $1 | |
else | |
< $2 openssl s_client -crlf -quiet -ign_eof -connect $1 > $3 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I usually drop this into my .dotfiles' bin for quick access.