Closed timotk closed 3 days ago
Hi @timotk
I think you're looking for file body request:
POST https://example.org
file,data.bin;
HTTP 200
If you're sending JSON data, you can add Content-Type
request header:
POST https://example.org
Content-Type: application/json
file,data.bin;
HTTP 200
You can see it also in the samples documentation
We'll also support, in the future the syntax you wanted to use
POST http://localhost:8000/ ``` {{ file data.json }} ``` HTTP 200
Hi @jcamiel, that's it, thanks a lot! Not sure how I missed that 🤷♂️
Documentation can always be improved though, don't hesitate to propose improvements!
First of all: I'm not sure if it is a feature request or I am doing something wrong!
Problem to solve
I have a very large JSON file, which includes some binary images. This data is quite large and would make the hurl file unreadable.
I have tried passing the body as a variable argument, as follows:
Then run it with:
hurl request.hurl --variable body='{}'
This works fine for simple JSON, but I can't get it to work with reading the JSON from a file.
I can imagine an option where we specify the file in the hurl file:
Related issues
https://github.com/Orange-OpenSource/hurl/issues/2145 https://github.com/Orange-OpenSource/hurl/issues/2258
Proposal
Have a simple way of reading the request body from another file (see above).