hurl/integration/tests_ok/json_output.hurl

61 lines
1.0 KiB
Plaintext
Raw Normal View History

2022-10-07 22:31:00 +03:00
# A test file with asserts, captures, redirection
# to test structured JSON output (with --json).
# Simple GET
GET http://localhost:8000/hello
2022-11-11 16:25:00 +03:00
HTTP 200
2022-12-02 22:50:27 +03:00
`Hello World!`
2022-10-07 22:31:00 +03:00
# Cookies!
GET http://localhost:8000/cookies/set-session-cookie2-valueA
2022-11-11 16:25:00 +03:00
HTTP 200
2022-10-07 22:31:00 +03:00
[Asserts]
cookie "cookie2" == "valueA"
# No redirect
GET http://localhost:8000/follow-redirect
2022-11-11 16:25:00 +03:00
HTTP 302
2022-10-07 22:31:00 +03:00
[Asserts]
header "Location" == "http://localhost:8000/following-redirect"
# With redirect
GET http://localhost:8000/follow-redirect
[Options]
location: true
2022-11-11 16:25:00 +03:00
HTTP 200
2022-10-07 22:31:00 +03:00
[Asserts]
header "Location" not exists
2022-12-02 22:50:27 +03:00
`Followed redirect!`
2022-10-07 22:31:00 +03:00
# Some Captures
GET http://localhost:8000/captures
2022-11-11 16:25:00 +03:00
HTTP 200
2022-10-07 22:31:00 +03:00
[Captures]
param1: header "header1"
param2: header "header2" regex "Hello (.*)!"
param3: header "header2" regex /Hello (.*)!/
2022-12-01 16:24:03 +03:00
data1: body
data2: variable "data1"
2022-10-07 22:31:00 +03:00
# Some JSON asserts
GET http://localhost:8000/assert-json
2022-11-11 16:25:00 +03:00
HTTP 200
2022-10-07 22:31:00 +03:00
[Asserts]
jsonpath "$.errors[1].id" == "error2"
jsonpath "$.tags" includes "test"
jsonpath "$.tags" not includes "prod"
jsonpath "$.tags" not includes null