test1671: verify -w '%{header_json}

This commit is contained in:
Daniel Stenberg 2022-03-17 23:11:22 +01:00
parent 62b60ed1a0
commit 160b640a8b
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 86 additions and 6 deletions

View file

@ -209,7 +209,7 @@ test1630 test1631 test1632 test1633 test1634 \
test1650 test1651 test1652 test1653 test1654 test1655 \
test1660 test1661 \
\
test1670 \
test1670 test1671 \
\
test1680 test1681 test1682 test1683 \
\

70
tests/data/test1671 Normal file
View file

@ -0,0 +1,70 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
-w
%header
</keywords>
</info>
#
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Set-Cookie: firstcookie=want1; path=/
Funny-head: yesyes
Set-Cookie: 2cookie=want2; path=/
Content-Type: text/html
Set-Cookie: cookie3=want3; path=/
Content-Length: 6
Connection: close
-foo-
</data>
</reply>
#
# Client-side
<client>
<server>
http
</server>
<name>
-w header JSON output
</name>
<command option="no-output">
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -w '%{header_json}\n' -o log/%TESTNUMBER.out
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
<stdout mode="text">
{"Date":["Tue, 09 Nov 2010 14:49:00 GMT"],
"Server":["test-server/fake"],
"Last-Modified":["Tue, 13 Jun 2000 12:10:00 GMT"],
"ETag":["\"21025-dc7-39462498\""],
"Accept-Ranges":["bytes"],
"Set-Cookie":["firstcookie=want1; path=/","2cookie=want2; path=/","cookie3=want3; path=/"],
"Content-Length":["6"],
"Connection":["close"]
}
</stdout>
</verify>
</testcase>
o