cURL to return response body and http response header

PHOTO EMBED

Tue Jan 24 2023 09:43:45 GMT+0000 (Coordinated Universal Time)

Saved by @Rohith #bash #sh #shell #curl #http

httpClient() {
    curl --silent \
    	# everything in between
         --write-out "\n%{http_code}"
}

response=`httpClient #args #args .....`

http_code=`tail -n1 <<< "$response"`
body=`sed '$ d' <<< "$response"`
content_copyCOPY