curl: add --fail-with-body

Prevent both --fail and --fail-with-body on the same command line.

Verify with test 349, 360 and 361.

Closes #6449
This commit is contained in:
Daniel Stenberg 2021-02-11 08:30:39 +01:00
parent c386a0df44
commit 8a964cb217
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
13 changed files with 179 additions and 14 deletions

View file

@ -58,9 +58,10 @@ test307 test308 test309 test310 test311 test312 test313 test314 test315 \
test316 test317 test318 test319 test320 test321 test322 test323 test324 \
test325 test326 test327 test328 test329 test330 test331 test332 test333 \
test334 test335 test336 test337 test338 test339 test340 test341 test342 \
test343 test344 test345 test346 test347 test348 \
test350 test351 test352 test353 test354 test355 test356 test357 test358 \
test359 \
test343 test344 test345 test346 test347 test348 test349 test350 test351 \
test352 test353 test354 test355 test356 test357 test358 test359 test360 \
test361 \
\
test393 test394 test395 test396 test397 \
\
test400 test401 test402 test403 test404 test405 test406 test407 test408 \

View file

@ -3,6 +3,7 @@
<keywords>
HTTP
HTTP GET
--fail
</keywords>
</info>
# Server-side

45
tests/data/test349 Normal file
View file

@ -0,0 +1,45 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
--fail-with-body
</keywords>
</info>
# Server-side
<reply>
<data>
HTTP/1.0 404 BAD BOY swsclose
Content-Type: text/html
This silly page doesn't reaaaaaly exist so you should not get it.
</data>
</reply>
# Client-side
<client>
<server>
http
</server>
<name>
HTTP GET --fail-with-body on HTTP error return
</name>
<command>
http://%HOSTIP:%HTTPPORT/349 --fail-with-body
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
GET /349 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
<errorcode>
22
</errorcode>
</verify>
</testcase>

28
tests/data/test360 Normal file
View file

@ -0,0 +1,28 @@
<testcase>
<info>
<keywords>
--fail
--fail-with-body
</keywords>
</info>
# Client-side
<client>
<server>
http
</server>
<name>
Error on both --fail-with-body and --fail
</name>
<command>
http://%HOSTIP:%HTTPPORT/360 --fail-with-body --fail
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<errorcode>
2
</errorcode>
</verify>
</testcase>

50
tests/data/test361 Normal file
View file

@ -0,0 +1,50 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
--fail-with-body
</keywords>
</info>
# Server-side
<reply>
<data>
HTTP/1.0 404 BAD BOY swsclose
Content-Type: text/html
This silly page doesn't reaaaaaly exist so you should not get it.
</data>
</reply>
# Client-side
<client>
<server>
http
</server>
<name>
HTTP GET --fail-with-body on HTTP error return - twice
</name>
<command>
http://%HOSTIP:%HTTPPORT/361 http://%HOSTIP:%HTTPPORT/361 --fail-with-body
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
GET /361 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
GET /361 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
<errorcode>
22
</errorcode>
</verify>
</testcase>