Orange-OpenSource / Orange-OpenSource/hurl

How to reuse captured bytes of previous response as `multipart/form-data` field in next request

Open
#3,752 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement topic: multipart
Dominant language
Rust
Stars
19.2k
Forks
745
Avg merge
5h 3m
Merged PRs (30d)
60

Description

Context

I am currently working on FlowG's backup feature (sorry for self-promotion). The End-To-End test suite of the API is written with Hurl (loves it by the way, thanks for the great work).

I'm trying to implement the backup&restore test. The idea is to send the API request for backup-ing, capturing the response body (which is the actual backup bundled in a binary file) as bytes, and then reuse the captured bytes as part of the "restore" API request.

I'm unsure if I'm misreading the docs, or if they are lacking, or if the feature simply does not exist.

Test case

I tried the following:

GET http://localhost:5080/api/v1/backup/logs
Authorization: Bearer pat:{{admin_token}}
HTTP 200
[Captures]
logs_backup: bytes

POST http://localhost:5080/api/v1/restore/logs
Authorization: Bearer pat:{{admin_token}}
[Multipart]
backup: {{logs_backup}}
HTTP 200

And:

GET http://localhost:5080/api/v1/backup/logs
Authorization: Bearer pat:{{admin_token}}
HTTP 200
[Captures]
logs_backup: bytes

POST http://localhost:5080/api/v1/restore/logs
Authorization: Bearer pat:{{admin_token}}
Content-Type: multipart/form-data; boundary=----test
```
----test
Content-Disposition: form-data; name="backup"; filename="logs.db"
Content-Type: application/octet-stream

{{logs_backup}}
----test
```
HTTP 200

But in both cases, I get the following error:

error: Unrenderable expression
  --> spec/backup.hurl:22:11
   |
   | POST http://localhost:5080/api/v1/restore/logs
   | ...
22 | backup: {{logs_backup}}
   |           ^^^^^^^^^^^ expression with value hex, <big hex value omitted>; can not be rendered
Execution context
  • Hurl Version (hurl --version):
hurl 6.0.0 (unknown) libcurl/8.12.1-DEV OpenSSL/3.0.13 zlib/1.3
Features (libcurl):  alt-svc AsynchDNS HSTS IPv6 libz SSL UnixSockets
Features (built-in): brotli

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the captured-bytes and multipart cases in spec/backup.hurl, using the reported Hurl 6.0.0 behavior as the baseline. Trace how byte captures are rendered in multipart fields; done means the captured backup can be sent in the restore request and the example receives HTTP 200.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.