mirror of
https://codeberg.org/vlw/curl.git
synced 2026-04-13 02:39:38 +02:00
feat: print response code to cli
This commit is contained in:
parent
a42be0792c
commit
5c8c693a90
1 changed files with 4 additions and 1 deletions
5
curl.sh
5
curl.sh
|
|
@ -66,8 +66,11 @@ curl_cmd="$curl_cmd -o $RESP_BODY_RAW_FILE -D $RESP_HEADERS_FILE"
|
||||||
# Execute curl
|
# Execute curl
|
||||||
eval "clear"
|
eval "clear"
|
||||||
|
|
||||||
echo -e "${method} ${url}"
|
echo -e "\e[0;92mRequest >\e[0m ${method} ${url}"
|
||||||
eval $curl_cmd
|
eval $curl_cmd
|
||||||
|
|
||||||
# Copy the raw respone body to a pretty-printed JSON file
|
# Copy the raw respone body to a pretty-printed JSON file
|
||||||
jq . $RESP_BODY_RAW_FILE > $RESP_BODY_JSON_FILE
|
jq . $RESP_BODY_RAW_FILE > $RESP_BODY_JSON_FILE
|
||||||
|
|
||||||
|
# Print the response code
|
||||||
|
echo -e -n "\e[0;94mResponse <\e[0m "; awk 'NR==1{print $2, $3; exit}' $RESP_HEADERS_FILE
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue