Is there a way to transform a Hurl file into its "already replaced variables" version ? #5084
Unanswered
AdmiralRazorbeard
asked this question in
Q&A
Replies: 2 comments
|
You can have something you want with a combination of First, given this file: GET http://localhost:8000/captures
X-Foo: foo
HTTP 200
[Captures]
param1: header "header1"
param2: header "header2" regex "Hello (.*)!"
param3: header "header2" regex /Hello (.*)!/
# With the next captures, we test that the captured variable
# can be immediately used in the next captures + asserts
data1: body
data2: variable "data1"
[Asserts]
header "header1" == "{{param1}}"
variable "param1" == "value1"
variable "param2" == "Bob"
variable "param3" == "Bob"
variable "data2" == "Hello world!"
GET http://localhost:8000/captures-check?q={{param1}}
[QueryStringParams]
param1: {{param1}}
param2: {{param2}}
HTTP 200
GET http://localhost:8000/captures-check
[Query]
param1: {{param1}}
param2: {{param2}}
HTTP 200You can run it and with $ hurl --curl out.txt test.hurlIn out.txt, you will have: Then with $ hurlfmt --in curl > out.hurlIn out.hurl: GET http://localhost:8000/captures
X-Foo: foo
GET http://localhost:8000/captures-check?q=value1¶m1=value1¶m2=Bob
GET http://localhost:8000/captures-check?param1=value1¶m2=BobYou can notice that you will lose asserts but this modop is maybe what's approaching the most your usecase. You can also explore |
0 replies
|
Thanks I'm going to try that ! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I've been building a hurl TUI to have a minimal Insomnia like experience for quite some time now and as I want to implement an history feature, I would like to be able to transform this
hurl my-request.hurl --variables-file ./my-env-file.envInto my-request_my-env-file-10-10-2026.hurl which contains
Is there a command like
hurl my-request.hurl --variables-file ./my-env-file.env --export-generated-hurl?Even better if we could exclude variables from the exported hurl file, for example {{bearer_token}}, so that we can easily execute it later for example
hurl my-request.hurl --variables-file ./my-env-file.env --export-generated-hurl --export-exclude bearer_token:All reactions