cURLでPOSTするときにJSONのデータを持たせてステータスコードだけチェックする方法
endpoint_test.sh
#!/bin/sh
SUCCESS=200
# GET
CODE=`curl -X GET -s -o /dev/null -w '%{http_code}\n' localhost:8000/endpoint
if [ $CODE -ne $SUCCESS ]; then
exit 1
fi
# POST w/ JSONファイル
CODE=`curl -X POST -s -o /dev/null -w '%{http_code}\n' -d @filename localhost:8000/endpoint`
if [ $CODE -ne $SUCCESS ]; then
exit 1
fi
Author And Source
この問題について(cURLでPOSTするときにJSONのデータを持たせてステータスコードだけチェックする方法), 我々は、より多くの情報をここで見つけました https://qiita.com/hayata-yamamoto/items/d84f5dbdd7f1ee6ffab4著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .