Orange-OpenSource / hurl

Hurl, run and test HTTP requests with plain text.
https://hurl.dev
Apache License 2.0
13.1k stars 490 forks source link

Allow body implicit assert before [Asserts] section or just change error message #3401

Open lepapareil opened 2 days ago

lepapareil commented 2 days ago

Problem to solve

I want this Hurl file whith implicit body assert before [Asserts] section to succeed:

GET https://hurl.dev/assets/img/logo-light.svg
HTTP 200
``` [Asserts] header "accept-ranges" == "bytes" ```` If we don't want to permit `implicit body assert` before `[Asserts]` section, then we have to improve the actual error message : ``` error: Parsing method --> -:9:1 | 9 | [Asserts] | ^ the HTTP method <> is not valid. Valid values are GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH | ```
jcamiel commented 2 days ago

According to the doc, the implicit body assert must be after the explicit asserts section https://hurl.dev/docs/response.html#structure We could try to improve the error though, because it must be a common error!