mirror of
https://codeberg.org/vlw/curl.git
synced 2026-04-12 18:29:38 +02:00
feat: print response code to CLI (#10)
Closes #8 Reviewed-on: https://codeberg.org/vlw/curl/pulls/10 Co-authored-by: vlw <victor@vlw.se> Co-committed-by: vlw <victor@vlw.se>
This commit is contained in:
parent
328cebc703
commit
e015174467
2 changed files with 5 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||

|
||||

|
||||
|
||||

|
||||
|
||||
|
|
|
|||
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
|
||||
eval "clear"
|
||||
|
||||
echo -e "${method} ${url}"
|
||||
echo -e "\e[0;92mRequest >\e[0m ${method} ${url}"
|
||||
eval $curl_cmd
|
||||
|
||||
# Copy the raw respone body to a pretty-printed 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