Re:Show HN: Hurl – Run and test HTTP requests with plain tex...
by fabricereix on Tuesday October 05, 2021 @09:34AM
(#28759233)
Yes, this is possible to chain a value from a response to the next request.
The value is extracted and stored in a variable.
This variable can be reused afterward.
# Get home:
GET https://example.net
HTTP/1.1 200
[Captures]
csrf_token: xpath "string(//meta[@name='_csrf_token']/@content)"
# Do login!
POST https://example.net/login?user=toto&password=1234
X-CSRF-TOKEN: {{csrf_token}}
HTTP/1.1 302
Is it possible to chain a value from a response to the next request? This would be useful for testing.
My understand is that between the header and the body there has to be a new line[0], in the docs seems like it's skipped[1], does it affect functionality if skipped? or is it intentional?
Thanks!
[0]: https://www.lifewire.com/hypertext-transfer-protocol-817944 [1]: https://hurl.dev/index.html#also-an-http-test-tool