hurl icon indicating copy to clipboard operation
hurl copied to clipboard

Delay option doesn't seem to work with POST http method

Open AdmiralRazorbeard opened this issue 4 months ago • 2 comments

What is the current bug behavior?

Maybe I'm missing something with the syntax but I can't achieve a POST with a delay

Steps to reproduce

GET https://api.agify.io/?name=meelad
[Options]
delay: 10s
HTTP 200

This work, no problem with GET

Attempt 1:

POST {{my_base_url}}/something
authorization: {{bearer_token}}
Content-Type: application/json
{
  "my": "body",
}
[Options]
delay: 10s
HTTP 201

the HTTP method <> is not valid. Valid values are GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH Attempt 2:

POST {{my_base_url}}/something
authorization: {{bearer_token}}
Content-Type: application/json
[Options]
delay: 10s
HTTP 201
{
  "my": "body",
}

There is a delay but no body is sent

What am I missing ?

Execution context

  • Hurl Version (hurl --version): 7.0.0

AdmiralRazorbeard avatar Sep 16 '25 16:09 AdmiralRazorbeard

Hi @AdmiralRazorbeard

You can see request and response structure here:

Basically HTTP 200 splits request configuration and response checks: everything before configures the request, everything after configures the asserts on response.

This file:

POST {{my_base_url}}/something
authorization: {{bearer_token}}
Content-Type: application/json
{
  "my": "body",
}
[Options]
delay: 10s
HTTP 201

Is not valid, the order is: headers, then sections then request body:

POST {{my_base_url}}/something
authorization: {{bearer_token}}
Content-Type: application/json
[Options]
delay: 10s
{
  "my": "body",
}
HTTP 201

Reference here => https://hurl.dev/docs/request.html#structure

In this file:

POST {{my_base_url}}/something
authorization: {{bearer_token}}
Content-Type: application/json
[Options]
delay: 10s
HTTP 201
{
  "my": "body",
}

The body is after HTTP 201 so it is an assert on the response body. There is effectively no request body.

Structures of Hurl file is split in the docs between request and response I will take your issue as an opportunity to improve the docs.

jcamiel avatar Sep 16 '25 20:09 jcamiel

Alright I get it now, your explanation with HTTP 200 splitting the request and response part is clear. Yes an exemple in the doc with a full request and response would be handy.

Thanks

AdmiralRazorbeard avatar Sep 17 '25 12:09 AdmiralRazorbeard