Skip to content

Commit

Permalink
Add invalid JSON body test case
Browse files Browse the repository at this point in the history
  • Loading branch information
domwebber committed Oct 19, 2024
1 parent 21bcdc7 commit 33314c1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ else
exit 1
fi

REQUEST=$(curl -s -X POST -H "Content-Type: application/json" -d 'not-json' http://localhost:8080)
if [ $(echo $REQUEST | jq -r '.json') == 'null' ]; then
passed "JSON with Invalid Body test passed."
else
failed "JSON with Invalid Body test failed."
echo $REQUEST | jq
exit 1
fi

message " Stop containers "
docker stop http-echo-tests
sleep 5
Expand Down

0 comments on commit 33314c1

Please sign in to comment.