Am trying to read a JSON file from a Unix Shell Script (am inside the same dir as product.json) and send it using curl.
curlProduct.sh:
for file in ~/work/project/json/product.json
do
echo "$file"
curl -X POST --data @"$file" 'http://localhost:8080/api/v1/purchaseProduct' \
--header 'Content-Type:application/json' \
--header 'Authorization: Bearer f682e27f-daf6-234r-3456-623b9fe65bds'
echo "After HTTP POST"
done
When I run this using:
sh curlProduct.sh
The only thing it does is print the fully qualified file path (along with name) seems to be hung at this line echo "$file", forcing me to to issue a control-c to cancel, every time:
/Users/pnwlover/work/project/json/product.json
What am I possibly doing wrong?
netcatinstalled, what doesnc -vvv localhost 8080do?Connection to localhost port 8080 [tcp/http-alt] succeeded!usingnetcatalong with command you suggested.