Skip to content

Commit 33314c1

Browse files
committed
Add invalid JSON body test case
1 parent 21bcdc7 commit 33314c1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ else
155155
exit 1
156156
fi
157157

158+
REQUEST=$(curl -s -X POST -H "Content-Type: application/json" -d 'not-json' http://localhost:8080)
159+
if [ $(echo $REQUEST | jq -r '.json') == 'null' ]; then
160+
passed "JSON with Invalid Body test passed."
161+
else
162+
failed "JSON with Invalid Body test failed."
163+
echo $REQUEST | jq
164+
exit 1
165+
fi
166+
158167
message " Stop containers "
159168
docker stop http-echo-tests
160169
sleep 5

0 commit comments

Comments
 (0)