5 points | by jicea 2 days ago
2 comments
So, I've used the VS Code and IntelliJ extensions that support ".http" files for making REST requests forever.
They're incredibly useful for embedding executable API documentation in your projects.
What I've always wanted is the ability to embed assertions on the response.
Something like:
POST http://api.mysite.com/todo Content-Type: application/json { "text": "Do the dishes" } ASSERT_RESPONSE_MATCHES { "id": 1, "text": "Do the dishes" }
Hurl's maintainer here,
you can add asserts on response body, headers, certificate etc with Hurl [1]:
GET https://example.org/api/tests/4567 HTTP 200 [Asserts] header "x-foo" contains "bar" certificate "Expire-Date" daysAfterNow > 15 ip == "2001:0db8:85a3:0000:0000:8a2e:0370:733" jsonpath "$.status" == "RUNNING" jsonpath "$.tests" count == 25 jsonpath "$.id" matches /\d{4}/
[1]: https://hurl.dev
[2]: https://hurl.dev/docs/asserting-response.html
So, I've used the VS Code and IntelliJ extensions that support ".http" files for making REST requests forever.
They're incredibly useful for embedding executable API documentation in your projects.
What I've always wanted is the ability to embed assertions on the response.
Something like:
Currently I do this with manual scriptingHurl's maintainer here,
you can add asserts on response body, headers, certificate etc with Hurl [1]:
You can see how you can make various asserts here [2][1]: https://hurl.dev
[2]: https://hurl.dev/docs/asserting-response.html