2022-11-21 17:08:03 +03:00
< pre > < code class = "language-hurl" > < span class = "hurl-entry" > < span class = "request" > < span class = "line" > < / span > < span class = "comment" > # In each request, we sent a multiline body and get< / span >
< span class = "line" > < / span > < span class = "comment" > # the same body as response. Request body is tested server side< / span >
< span class = "line" > < / span > < span class = "comment" > # and we assert the response here.< / span >
< span class = "line" > < / span >
< span class = "line" > < span class = "method" > POST< / span > < span class = "url" > http://localhost:8000/multilines/plain-text< / span > < / span >
< span class = "multiline" > < span class = "line" > ```< / span >
< span class = "line" > line1< / span >
< span class = "line" > line2< / span >
< span class = "line" > line3< / span >
< span class = "line" > ```< / span > < / span >
2022-11-15 14:00:29 +03:00
< / span > < span class = "response" > < span class = "line" > < / span >
< span class = "line" > < span class = "version" > HTTP< / span > < span class = "number" > 200< / span > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < / span > < span class = "comment" > # Different ways of testing body response:< / span >
< span class = "line" > < / span > < span class = "comment" > # with explicit asserts:< / span >
2023-04-11 18:28:28 +03:00
< span class = "line" > < span class = "section-header" > [Asserts]< / span > < / span >
2021-09-21 07:36:53 +03:00
< span class = "line" > < span class = "query-type" > body< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "line1\nline2\nline3\n"< / span > < / span >
2023-04-17 15:01:37 +03:00
< span class = "line" > < span class = "query-type" > body< / span > < span class = "predicate-type" > ==< / span > < span class = "multiline" > ```< / span > < / span >
< span class = "multiline" > < span class = "line" > line1< / span >
2021-09-21 07:36:53 +03:00
< span class = "line" > line2< / span >
< span class = "line" > line3< / span >
2023-04-17 15:01:37 +03:00
< span class = "line" > ```< / span > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < / span > < span class = "comment" > # Or we can just test the body (implicit assert):< / span >
< span class = "multiline" > < span class = "line" > ```< / span >
< span class = "line" > line1< / span >
< span class = "line" > line2< / span >
< span class = "line" > line3< / span >
2022-11-15 14:00:29 +03:00
< span class = "line" > ```< / span > < / span >
< / span > < / span > < span class = "hurl-entry" > < span class = "request" > < span class = "line" > < / span >
< span class = "line" > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < span class = "method" > POST< / span > < span class = "url" > http://localhost:8000/multilines/json< / span > < / span >
< span class = "multiline" > < span class = "line" > ```json< / span >
< span class = "line" > {< / span >
< span class = "line" > "foo": "bar"< / span >
< span class = "line" > "baz": 123456< / span >
< span class = "line" > }< / span >
2022-11-15 14:00:29 +03:00
< span class = "line" > ```< / span > < / span >
< / span > < span class = "response" > < span class = "line" > < / span >
< span class = "line" > < span class = "version" > HTTP< / span > < span class = "number" > 200< / span > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < / span > < span class = "comment" > # Different ways of testing body response:< / span >
< span class = "line" > < / span > < span class = "comment" > # with explicit asserts:< / span >
2023-04-11 18:28:28 +03:00
< span class = "line" > < span class = "section-header" > [Asserts]< / span > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < span class = "query-type" > body< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "{\n \"foo\": \"bar\"\n \"baz\": 123456\n}\n"< / span > < / span >
2023-04-17 15:01:37 +03:00
< span class = "line" > < span class = "query-type" > body< / span > < span class = "predicate-type" > ==< / span > < span class = "multiline" > ```json< / span > < / span >
< span class = "multiline" > < span class = "line" > {< / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > "foo": "bar"< / span >
< span class = "line" > "baz": 123456< / span >
< span class = "line" > }< / span >
2023-04-17 15:01:37 +03:00
< span class = "line" > ```< / span > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < / span > < span class = "comment" > # Or we can just test the body (implicit assert):< / span >
2022-11-18 16:26:00 +03:00
< span class = "multiline" > < span class = "line" > ```json< / span >
2022-11-15 14:00:29 +03:00
< span class = "line" > {< / span >
< span class = "line" > "foo": "bar"< / span >
< span class = "line" > "baz": 123456< / span >
< span class = "line" > }< / span >
< span class = "line" > ```< / span > < / span >
< / span > < / span > < span class = "hurl-entry" > < span class = "request" > < span class = "line" > < / span >
< span class = "line" > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < / span >
< span class = "line" > < span class = "method" > POST< / span > < span class = "url" > http://localhost:8000/multilines/xml< / span > < / span >
< span class = "multiline" > < span class = "line" > ```xml< / span >
< span class = "line" > < ?xml version="1.0"?> < / span >
< span class = "line" > < catalog> < / span >
< span class = "line" > < book id="bk101"> < / span >
< span class = "line" > < author> Gambardella, Matthew< /author> < / span >
< span class = "line" > < title> XML Developer's Guide< /title> < / span >
< span class = "line" > < genre> Computer< /genre> < / span >
< span class = "line" > < price> 44.95< /price> < / span >
< span class = "line" > < publish_date> 2000-10-01< /publish_date> < / span >
< span class = "line" > < description> An in-depth look at creating applications< / span >
< span class = "line" > with XML.< /description> < / span >
< span class = "line" > < /book> < / span >
< span class = "line" > < /catalog> < / span >
< span class = "line" > ```< / span > < / span >
2022-11-15 14:00:29 +03:00
< / span > < span class = "response" > < span class = "line" > < / span >
< span class = "line" > < span class = "version" > HTTP< / span > < span class = "number" > 200< / span > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < / span > < span class = "comment" > # Different ways of testing body response:< / span >
< span class = "line" > < / span > < span class = "comment" > # with explicit asserts:< / span >
2023-04-11 18:28:28 +03:00
< span class = "line" > < span class = "section-header" > [Asserts]< / span > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < span class = "query-type" > body< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "< ?xml version=\"1.0\"?> \n< catalog> \n < book id=\"bk101\"> \n < author> Gambardella, Matthew< /author> \n < title> XML Developer's Guide< /title> \n < genre> Computer< /genre> \n < price> 44.95< /price> \n < publish_date> 2000-10-01< /publish_date> \n < description> An in-depth look at creating applications\n with XML.< /description> \n < /book> \n< /catalog> \n"< / span > < / span >
2023-04-17 15:01:37 +03:00
< span class = "line" > < span class = "query-type" > body< / span > < span class = "predicate-type" > ==< / span > < span class = "multiline" > ```xml< / span > < / span >
< span class = "multiline" > < span class = "line" > < ?xml version="1.0"?> < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < catalog> < / span >
< span class = "line" > < book id="bk101"> < / span >
< span class = "line" > < author> Gambardella, Matthew< /author> < / span >
< span class = "line" > < title> XML Developer's Guide< /title> < / span >
< span class = "line" > < genre> Computer< /genre> < / span >
< span class = "line" > < price> 44.95< /price> < / span >
< span class = "line" > < publish_date> 2000-10-01< /publish_date> < / span >
< span class = "line" > < description> An in-depth look at creating applications< / span >
< span class = "line" > with XML.< /description> < / span >
< span class = "line" > < /book> < / span >
< span class = "line" > < /catalog> < / span >
2023-04-17 15:01:37 +03:00
< span class = "line" > ```< / span > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < / span > < span class = "comment" > # Or we can just test the body (implicit assert):< / span >
2022-11-18 16:26:00 +03:00
< span class = "multiline" > < span class = "line" > ```xml< / span >
2022-11-15 14:00:29 +03:00
< span class = "line" > < ?xml version="1.0"?> < / span >
< span class = "line" > < catalog> < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < book id="bk101"> < / span >
< span class = "line" > < author> Gambardella, Matthew< /author> < / span >
< span class = "line" > < title> XML Developer's Guide< /title> < / span >
< span class = "line" > < genre> Computer< /genre> < / span >
< span class = "line" > < price> 44.95< /price> < / span >
< span class = "line" > < publish_date> 2000-10-01< /publish_date> < / span >
< span class = "line" > < description> An in-depth look at creating applications< / span >
< span class = "line" > with XML.< /description> < / span >
< span class = "line" > < /book> < / span >
2022-11-15 14:00:29 +03:00
< span class = "line" > < /catalog> < / span >
< span class = "line" > ```< / span > < / span >
< / span > < / span > < span class = "hurl-entry" > < span class = "request" > < span class = "line" > < / span >
< span class = "line" > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < / span >
< span class = "line" > < span class = "method" > POST< / span > < span class = "url" > http://localhost:8000/multilines/graphql< / span > < / span >
< span class = "multiline" > < span class = "line" > ```graphql< / span >
< span class = "line" > {< / span >
< span class = "line" > hero {< / span >
< span class = "line" > name< / span >
< span class = "line" > # Queries can have comments!< / span >
< span class = "line" > friends {< / span >
< span class = "line" > name< / span >
< span class = "line" > }< / span >
< span class = "line" > }< / span >
< span class = "line" > }< / span >
< span class = "line" > ```< / span > < / span >
< / span > < span class = "response" > < span class = "line" > < span class = "version" > HTTP< / span > < span class = "number" > 200< / span > < / span >
< span class = "line" > < / span > < span class = "comment" > # Different ways of testing body response:< / span >
< span class = "line" > < / span > < span class = "comment" > # with explicit asserts:< / span >
2023-04-11 18:28:28 +03:00
< span class = "line" > < span class = "section-header" > [Asserts]< / span > < / span >
2022-11-24 18:14:44 +03:00
< span class = "line" > < span class = "query-type" > body< / span > < span class = "predicate-type" > ==< / span > < span class = "string" > "{\"query\":\"{\\n hero {\\n name\\n # Queries can have comments!\\n friends {\\n name\\n }\\n }\\n}\"}"< / span > < / span >
2023-04-17 15:01:37 +03:00
< span class = "line" > < span class = "query-type" > body< / span > < span class = "predicate-type" > ==< / span > < span class = "multiline" > ```graphql< / span > < / span >
< span class = "multiline" > < span class = "line" > {< / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > hero {< / span >
< span class = "line" > name< / span >
< span class = "line" > # Queries can have comments!< / span >
< span class = "line" > friends {< / span >
< span class = "line" > name< / span >
< span class = "line" > }< / span >
< span class = "line" > }< / span >
< span class = "line" > }< / span >
2023-04-17 15:01:37 +03:00
< span class = "line" > ```< / span > < / span >
2022-11-21 17:08:03 +03:00
< span class = "line" > < / span > < span class = "comment" > # Or we can just test the body (implicit assert):< / span >
2022-11-18 16:26:00 +03:00
< span class = "multiline" > < span class = "line" > ```graphql< / span >
2022-11-15 14:00:29 +03:00
< span class = "line" > {< / span >
< span class = "line" > hero {< / span >
< span class = "line" > name< / span >
< span class = "line" > # Queries can have comments!< / span >
< span class = "line" > friends {< / span >
< span class = "line" > name< / span >
< span class = "line" > }< / span >
< span class = "line" > }< / span >
< span class = "line" > }< / span >
< span class = "line" > ```< / span > < / span >
< / span > < / span > < / code > < / pre >