Skip to content

Commit fe7dd4d

Browse files
eyupcanakmanhurl-bot
authored andcommitted
Add --variables-file per request option
1 parent cb54bb6 commit fe7dd4d

37 files changed

Lines changed: 529 additions & 12 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ to configure Hurl, there are three sources from the lowest priority (most easily
15371537
| <a href="#test" id="test"><code>--test</code></a> | Activate test mode: with this, the HTTP response is not outputted anymore, progress is reported for each Hurl file tested, and a text summary is displayed when all files have been run.<br><br>In test mode, files are executed in parallel. To run test in a sequential way use `--jobs 1`.<br><br>See also [`--jobs`](#jobs).<br><br>Environment variables: HURL_TEST<br><br>This is a cli-only option.<br> |
15381538
| <a href="#to-entry" id="to-entry"><code>--to-entry &lt;ENTRY_NUMBER&gt;</code></a> | Execute Hurl file to ENTRY_NUMBER (starting at 1).<br>Ignore the remaining of the file. It is useful for debugging a session.<br><br>This is a cli-only option.<br> |
15391539
| <a href="#variable" id="variable"><code>--variable &lt;NAME=VALUE&gt;</code></a> | Define variable (name/value) to be used in Hurl templates.<br><br>Environment variables: HURL_VARIABLE_name<br> |
1540-
| <a href="#variables-file" id="variables-file"><code>--variables-file &lt;FILE&gt;</code></a> | Set properties file in which your define your variables.<br><br>Each variable is defined as name=value exactly as with [`--variable`](#variable) option.<br><br>Note that defining a variable twice produces an error.<br><br>This is a cli-only option.<br> |
1540+
| <a href="#variables-file" id="variables-file"><code>--variables-file &lt;FILE&gt;</code></a> | Set properties file in which your define your variables.<br><br>Each variable is defined as name=value exactly as with [`--variable`](#variable) option.<br><br>Note that defining a variable twice produces an error.<br> |
15411541

15421542
### Report options
15431543

docs/manual.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ to configure Hurl, there are three sources from the lowest priority (most easily
237237
| <a href="#test" id="test"><code>--test</code></a> | Activate test mode: with this, the HTTP response is not outputted anymore, progress is reported for each Hurl file tested, and a text summary is displayed when all files have been run.<br><br>In test mode, files are executed in parallel. To run test in a sequential way use `--jobs 1`.<br><br>See also [`--jobs`](#jobs).<br><br>Environment variables: HURL_TEST<br><br>This is a cli-only option.<br> |
238238
| <a href="#to-entry" id="to-entry"><code>--to-entry &lt;ENTRY_NUMBER&gt;</code></a> | Execute Hurl file to ENTRY_NUMBER (starting at 1).<br>Ignore the remaining of the file. It is useful for debugging a session.<br><br>This is a cli-only option.<br> |
239239
| <a href="#variable" id="variable"><code>--variable &lt;NAME=VALUE&gt;</code></a> | Define variable (name/value) to be used in Hurl templates.<br><br>Environment variables: HURL_VARIABLE_name<br> |
240-
| <a href="#variables-file" id="variables-file"><code>--variables-file &lt;FILE&gt;</code></a> | Set properties file in which your define your variables.<br><br>Each variable is defined as name=value exactly as with [`--variable`](#variable) option.<br><br>Note that defining a variable twice produces an error.<br><br>This is a cli-only option.<br> |
240+
| <a href="#variables-file" id="variables-file"><code>--variables-file &lt;FILE&gt;</code></a> | Set properties file in which your define your variables.<br><br>Each variable is defined as name=value exactly as with [`--variable`](#variable) option.<br><br>Note that defining a variable twice produces an error.<br> |
241241

242242
### Report options
243243

docs/manual/hurl.1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,6 @@ Each variable is defined as name=value exactly as with \fI--variable\fP option.
626626

627627
Note that defining a variable twice produces an error.
628628

629-
This is a cli-only option.
630-
631629
.SS "Report options"
632630

633631
.IP "--report-html <DIR> "

docs/manual/hurl.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,6 @@ Each variable is defined as name=value exactly as with [`--variable`](#variable)
639639

640640
Note that defining a variable twice produces an error.
641641

642-
This is a cli-only option.
643-
644642
### Report options
645643

646644
#### --report-html <DIR> {#report-html}

docs/request.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,14 @@ user: bob:secret # use basic authentication
229229
proxy: my.proxy:8012 # define proxy (host:port where host can be an IP address)
230230
variable: country=Italy # define variable country
231231
variable: planet=Earth # define variable planet
232+
variables-file: vars.env # define variables from a properties file
232233
verbose: true # allow verbose output
233234
very-verbose: true # allow more verbose output
234235
```
235236

236-
> Variable defined in an `[Options]` section are defined also for the next entries. This is
237-
> the exception, all other options are defined only for the current request.
237+
> Variables defined in an `[Options]` section, including values loaded from `variables-file`, are
238+
> defined also for the next entries. This is the exception, all other options are defined only for
239+
> the current request.
238240
239241
### Query parameters
240242

docs/spec/grammar/hurl.grammar

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ option:
155155
| unix-socket-option
156156
| user-option
157157
| variable-option
158+
| variables-file-option
158159
| verbose-option
159160
| verbosity-option
160161
| very-verbose-option
@@ -238,6 +239,8 @@ user-option: "user" ":" value-string lt
238239

239240
variable-option: "variable" ":" variable-definition lt
240241

242+
variables-file-option: "variables-file" ":" filename lt
243+
241244
verbose-option: "verbose" ":" boolean-option lt
242245

243246
verbosity-option: "verbosity" ":" ( "brief" | "verbose" | "debug")

docs/spec/options/hurl/variables_file.option

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ value: FILE
44
help: Define a properties file in which you define your variables
55
help_heading: Run options
66
multi: append
7-
cli_only: true
87
---
98
Set properties file in which your define your variables.
109

integration/hurl/tests_error_parser/invalid_option.err

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error: Parsing option
22
--> tests_error_parser/invalid_option.hurl:3:1
33
|
44
3 | foo: true
5-
| ^ the option name is not valid. Valid values are aws-sigv4, cacert, cert, compressed, connect-timeout, connect-to, delay, digest, header, http1.0, http1.1, http2, http2-prior-knowledge, http3, insecure, ipv4, ipv6, key, limit-rate, location, location-trusted, max-redirs, max-time, negotiate, netrc, netrc-file, netrc-optional, no-proxy, ntlm, output, path-as-is, pinnedpubkey, proxy, repeat, resolve, retry, retry-interval, skip, unix-socket, user, variable, verbose, verbosity, very-verbose
5+
| ^ the option name is not valid. Valid values are aws-sigv4, cacert, cert, compressed, connect-timeout, connect-to, delay, digest, header, http1.0, http1.1, http2, http2-prior-knowledge, http3, insecure, ipv4, ipv6, key, limit-rate, location, location-trusted, max-redirs, max-time, negotiate, netrc, netrc-file, netrc-optional, no-proxy, ntlm, output, path-as-is, pinnedpubkey, proxy, repeat, resolve, retry, retry-interval, skip, unix-socket, user, variable, variables-file, verbose, verbosity, very-verbose
66
|
77

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
a=1
2+
this_line_has_no_equals
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: Invalid option value
2+
--> tests_failed/variables_file/variables_file_invalid.hurl:3:17
3+
|
4+
| GET http://localhost:8000/hello
5+
| ...
6+
3 | variables-file: tests_failed/variables_file/variables_file_invalid.env
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid variables-file option value <this_line_has_no_equals>: Missing value for variable this_line_has_no_equals!
8+
|
9+
10+
error: Undefined variable
11+
--> tests_failed/variables_file/variables_file_invalid.hurl:8:15
12+
|
13+
| GET http://localhost:8000/hello
14+
| ...
15+
8 | variable: b={{a}}
16+
| ^ you must set the variable a
17+
|
18+

0 commit comments

Comments
 (0)