diff --git a/README.md b/README.md
index 1aa31bed0..ad786849e 100644
--- a/README.md
+++ b/README.md
@@ -557,6 +557,7 @@ jsonpath "$.links" count == 12
jsonpath "$.state" != null
jsonpath "$.order" matches "^order-\\d{8}$"
jsonpath "$.order" matches /^order-\d{8}$/ # Alternative syntax with regex literal
+jsonpath "$.created" isIsoDate
```
[Doc](https://hurl.dev/docs/asserting-response.html#jsonpath-assert)
@@ -996,7 +997,7 @@ will follow a redirection only for the second entry.
| --test
| 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.
This is a cli-only option.
|
| --to-entry <ENTRY_NUMBER>
| Execute Hurl file to ENTRY_NUMBER (starting at 1).
Ignore the remaining of the file. It is useful for debugging a session.
This is a cli-only option.
|
| --unix-socket <PATH>
| (HTTP) Connect through this Unix domain socket, instead of using the network.
|
-| -u, --user <USER:PASSWORD>
| Add basic Authentication header to each request.
This is a cli-only option.
|
+| -u, --user <USER:PASSWORD>
| Add basic Authentication header to each request.
|
| -A, --user-agent <NAME>
| Specify the User-Agent string to send to the HTTP server.
This is a cli-only option.
|
| --variable <NAME=VALUE>
| Define variable (name/value) to be used in Hurl templates.
|
| --variables-file <FILE>
| Set properties file in which your define your variables.
Each variable is defined as name=value exactly as with [`--variable`](#variable) option.
Note that defining a variable twice produces an error.
This is a cli-only option.
|
diff --git a/bin/release/gen_manpage.py b/bin/release/gen_manpage.py
index a8201225c..dc1655c42 100755
--- a/bin/release/gen_manpage.py
+++ b/bin/release/gen_manpage.py
@@ -13,16 +13,15 @@ Examples:
import sys
import re
from datetime import date
+from typing import Optional
-def header(version, date):
- return '.TH hurl 1 "%s" "hurl %s" " Hurl Manual"' % (
- date.strftime("%d %b %Y"),
- version,
- )
+def header(version: str, today: date) -> str:
+ today_formatted = today.strftime("%d %b %Y")
+ return f'.TH hurl 1 "{today_formatted}" "hurl {version}" " Hurl Manual"'
-def version():
+def version() -> Optional[str]:
p = re.compile('version = "(.*)"')
for line in open("packages/hurl/Cargo.toml", "r").readlines():
m = p.match(line)
@@ -31,7 +30,7 @@ def version():
return None
-def process_code_block(s):
+def process_code_block(s: str) -> str:
output = ""
indent = False
for line in s.split("\n"):
@@ -47,25 +46,24 @@ def process_code_block(s):
output += "\n"
return output
- # p.sub('\\\\f[C]\\1\\\\f[R]', s)
-def convert_md(s):
- p = re.compile("^###\s+(.*)")
+def convert_md(s) -> str:
+ p = re.compile(r"^###\s+(.*)")
s = p.sub('.IP "\\1"', s)
- p = re.compile("^##")
+ p = re.compile(r"^##")
s = p.sub(".SH", s)
- p = re.compile("\*\*(.*)\*\*\s+")
+ p = re.compile(r"\*\*(.*)\*\*\s+")
s = p.sub(".B \\1\n", s)
# Remove link Text
- p = re.compile("\[`?(.*?)`?\]\(.*?\)")
+ p = re.compile(r"\[`?(.*?)`?\]\(.*?\)")
s = p.sub("\\\\fI\\1\\\\fP", s)
# Remove local anchor
- p = re.compile("{#.*}")
+ p = re.compile(r"{#.*}")
s = p.sub("", s)
return s
diff --git a/docs/grammar.md b/docs/grammar.md
index ffa103355..fa98009f0 100644
--- a/docs/grammar.md
+++ b/docs/grammar.md
@@ -77,7 +77,7 @@ Short description:
+(aws-sigv4-option|ca-certificate-option|client-certificate-option|client-key-option|compressed-option|connect-to-option|delay-option|follow-redirect-option|follow-redirect-trusted-option|http10-option|http11-option|http2-option|http3-option|insecure-option|ipv4-option|ipv6-option|max-redirs-option|netrc-option|netrc-file-option|netrc-optional-option|output-option|path-as-is-option|proxy-option|resolve-option|retry-option|retry-interval-option|skip-option|unix-socket-option|user-option|variable-option|verbose-option|very-verbose-option)
aws-sigv4-option(used by option)
ca-certificate-option(used by option)
client-certificate-option(used by option)
@@ -106,6 +106,7 @@ Short description:
retry-interval-option(used by option)
unix-socket-option(used by option)
+
variable-option(used by option)
verbose-option(used by option)
very-verbose-option(used by option)
@@ -215,7 +216,7 @@ Short description:
-
+value-string(used by request, key-value, aws-sigv4-option, client-key-option, connect-to-option, netrc-file-option, output-option, proxy-option, resolve-option, unix-socket-option, user-option)
@@ -306,7 +307,7 @@ Short description:
sp(used by request, response, capture, assert, header-query, certificate-query, cookie-query, xpath-query, jsonpath-query, regex-query, variable-query, predicate, equal-predicate, not-equal-predicate, greater-predicate, greater-or-equal-predicate, less-predicate, less-or-equal-predicate, start-with-predicate, end-with-predicate, contain-predicate, match-predicate, include-predicate, expr, jsonpath-filter, nth-filter, regex-filter, replace-filter, split-filter, xpath-filter, lt) [ \t]
-lt(used by hurl-file, request, response, header, body, query-string-params-section, form-params-section, multipart-form-data-section, cookies-section, captures-section, asserts-section, basic-auth-section, options-section, file-param, capture, assert, option, aws-sigv4-option, ca-certificate-option, client-certificate-option, client-key-option, compressed-option, connect-to-option, delay-option, follow-redirect-option, follow-redirect-trusted-option, http10-option, http11-option, http2-option, http3-option, insecure-option, ipv4-option, ipv6-option, max-redirs-option, netrc-option, netrc-file-option, netrc-optional-option, output-option, path-as-is-option, proxy-option, resolve-option, retry-option, retry-interval-option, skip-option, unix-socket-option, variable-option, verbose-option, very-verbose-option, multiline-string)
+lt(used by hurl-file, request, response, header, body, query-string-params-section, form-params-section, multipart-form-data-section, cookies-section, captures-section, asserts-section, basic-auth-section, options-section, file-param, capture, assert, option, aws-sigv4-option, ca-certificate-option, client-certificate-option, client-key-option, compressed-option, connect-to-option, delay-option, follow-redirect-option, follow-redirect-trusted-option, http10-option, http11-option, http2-option, http3-option, insecure-option, ipv4-option, ipv6-option, max-redirs-option, netrc-option, netrc-file-option, netrc-optional-option, output-option, path-as-is-option, proxy-option, resolve-option, retry-option, retry-interval-option, skip-option, unix-socket-option, user-option, variable-option, verbose-option, very-verbose-option, multiline-string)
regex-content(used by regex)
diff --git a/docs/manual.md b/docs/manual.md
index 105eb2857..def49f0d2 100644
--- a/docs/manual.md
+++ b/docs/manual.md
@@ -198,7 +198,7 @@ will follow a redirection only for the second entry.
| --test
| 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.
This is a cli-only option.
|
| --to-entry <ENTRY_NUMBER>
| Execute Hurl file to ENTRY_NUMBER (starting at 1).
Ignore the remaining of the file. It is useful for debugging a session.
This is a cli-only option.
|
| --unix-socket <PATH>
| (HTTP) Connect through this Unix domain socket, instead of using the network.
|
-| -u, --user <USER:PASSWORD>
| Add basic Authentication header to each request.
This is a cli-only option.
|
+| -u, --user <USER:PASSWORD>
| Add basic Authentication header to each request.
|
| -A, --user-agent <NAME>
| Specify the User-Agent string to send to the HTTP server.
This is a cli-only option.
|
| --variable <NAME=VALUE>
| Define variable (name/value) to be used in Hurl templates.
|
| --variables-file <FILE>
| Set properties file in which your define your variables.
Each variable is defined as name=value exactly as with [`--variable`](#variable) option.
Note that defining a variable twice produces an error.
This is a cli-only option.
|
diff --git a/docs/manual/hurl.1 b/docs/manual/hurl.1
index 49b6a7bb1..199e1d7a8 100644
--- a/docs/manual/hurl.1
+++ b/docs/manual/hurl.1
@@ -1,4 +1,4 @@
-.TH hurl 1 "19 Mar 2024" "hurl 4.3.0-SNAPSHOT" " Hurl Manual"
+.TH hurl 1 "26 Mar 2024" "hurl 4.3.0-SNAPSHOT" " Hurl Manual"
.SH NAME
hurl - run and test HTTP requests.
@@ -420,8 +420,6 @@ This is a cli-only option.
Add basic Authentication header to each request.
-This is a cli-only option.
-
.IP "-A, --user-agent "
Specify the User-Agent string to send to the HTTP server.
diff --git a/docs/manual/hurl.md b/docs/manual/hurl.md
index 520767ba0..590b6ac9d 100644
--- a/docs/manual/hurl.md
+++ b/docs/manual/hurl.md
@@ -439,8 +439,6 @@ This is a cli-only option.
Add basic Authentication header to each request.
-This is a cli-only option.
-
### -A, --user-agent {#user-agent}
Specify the User-Agent string to send to the HTTP server.
diff --git a/docs/manual/hurlfmt.1 b/docs/manual/hurlfmt.1
index be17861b5..3c2f664ed 100644
--- a/docs/manual/hurlfmt.1
+++ b/docs/manual/hurlfmt.1
@@ -1,4 +1,4 @@
-.TH hurl 1 "19 Mar 2024" "hurl 4.3.0-SNAPSHOT" " Hurl Manual"
+.TH hurl 1 "26 Mar 2024" "hurl 4.3.0-SNAPSHOT" " Hurl Manual"
.SH NAME
hurlfmt - format Hurl files
diff --git a/docs/spec/grammar/hurl.grammar b/docs/spec/grammar/hurl.grammar
index 01913e205..e98c89055 100644
--- a/docs/spec/grammar/hurl.grammar
+++ b/docs/spec/grammar/hurl.grammar
@@ -144,6 +144,7 @@ option:
| retry-interval-option
| skip-option
| unix-socket-option
+ | user-option
| variable-option
| verbose-option
| very-verbose-option
@@ -205,6 +206,8 @@ skip-option: "skip" ":" boolean-option lt
unix-socket-option: "unix-socket" ":" value-string lt
+user-option: "user" ":" value-string lt
+
variable-option: "variable" ":" variable-definition lt
verbose-option: "verbose" ":" boolean-option lt
diff --git a/docs/spec/options/hurl/user.option b/docs/spec/options/hurl/user.option
index c76077e20..9eb87ea9c 100644
--- a/docs/spec/options/hurl/user.option
+++ b/docs/spec/options/hurl/user.option
@@ -3,6 +3,5 @@ long: user
short: u
value: USER:PASSWORD
help: Add basic Authentication header to each request
-cli_only: true
---
Add basic Authentication header to each request.
diff --git a/integration/hurl/tests_ok/aws_sigv4_option.hurl b/integration/hurl/tests_ok/aws_sigv4_option.hurl
index cf4f03be7..9094ad2e1 100644
--- a/integration/hurl/tests_ok/aws_sigv4_option.hurl
+++ b/integration/hurl/tests_ok/aws_sigv4_option.hurl
@@ -3,6 +3,6 @@ POST http://localhost:8000/aws-sigv4
test: test
[Options]
aws-sigv4: aws:amz:eu-central-1:hurltest
-
+user: someAccessKeyId:someSecretKey
HTTP 200
diff --git a/integration/hurl/tests_ok/aws_sigv4_option.ps1 b/integration/hurl/tests_ok/aws_sigv4_option.ps1
index 7e80be24d..8e007998f 100644
--- a/integration/hurl/tests_ok/aws_sigv4_option.ps1
+++ b/integration/hurl/tests_ok/aws_sigv4_option.ps1
@@ -1,3 +1,3 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
-hurl --user someAccessKeyId:someSecretKey tests_ok/aws_sigv4_option.hurl --verbose
+hurl tests_ok/aws_sigv4_option.hurl --verbose
diff --git a/integration/hurl/tests_ok/aws_sigv4_option.sh b/integration/hurl/tests_ok/aws_sigv4_option.sh
index 970310318..ee1f51a79 100755
--- a/integration/hurl/tests_ok/aws_sigv4_option.sh
+++ b/integration/hurl/tests_ok/aws_sigv4_option.sh
@@ -10,4 +10,4 @@ if curl --aws-sigv4 2>&1 | grep -q 'option --aws-sigv4: is unknown'; then
fi
set -Eeuo pipefail
-hurl --user someAccessKeyId:someSecretKey tests_ok/aws_sigv4_option.hurl
+hurl tests_ok/aws_sigv4_option.hurl
diff --git a/integration/hurlfmt/tests_export/options.html b/integration/hurlfmt/tests_export/options.html
index 47a15fcdb..aff0db45a 100644
--- a/integration/hurlfmt/tests_export/options.html
+++ b/integration/hurlfmt/tests_export/options.html
@@ -31,6 +31,7 @@
retry-interval: 1000
skip: false
unix-socket: build/unix_socket.sock
+user: bob:secret
variable: user=null
variable: status=true
variable: count=2
@@ -42,13 +43,14 @@
GET http://localhost:8000/hello
aws-sigv4: {{aws-sigv4}}
-
+cacert: {{cacert}}
cert: {{cert}}
-
+key: {{key}}
compressed: {{compressed}}
connect-to: {{connect-to}}
delay: {{delay}}
location: {{location}}
+location-trusted: {{location-trusted}}
http1.0: {{http10}}
http1.1: {{http11}}
http2: {{http2}}
@@ -58,17 +60,18 @@
ipv6: {{ipv6}}
max-redirs: {{max-redirs}}
netrc: {{netrc}}
-
+netrc-file: {{netrc-file}}
netrc-optional: {{netrc-optional}}
-
+output: {{output}}
path-as-is: {{path-as-is}}
proxy: {{proxy}}
resolve: {{resolve}}
retry: {{retry}}
retry-interval: {{retry-interval}}
skip: {{skip}}
+unix-socket: {{socket-file}}
+user: {{user}}
-unix-socket: {{socket_file}}
verbose: {{verbose}}
very-verbose: {{very-verbose}}
diff --git a/integration/hurlfmt/tests_export/options.hurl b/integration/hurlfmt/tests_export/options.hurl
index 1ed92b81e..1c03cebb5 100644
--- a/integration/hurlfmt/tests_export/options.hurl
+++ b/integration/hurlfmt/tests_export/options.hurl
@@ -31,6 +31,7 @@ retry: 4
retry-interval: 1000
skip: false
unix-socket: build/unix_socket.sock
+user: bob:secret
variable: user=null
variable: status=true
variable: count=2
@@ -42,13 +43,14 @@ very-verbose: false
GET http://localhost:8000/hello
[Options]
aws-sigv4: {{aws-sigv4}}
-#cacert: {{cacert}} NOT SUPPORTED YET
+cacert: {{cacert}}
cert: {{cert}}
-#key: {{key}} NOT SUPPORTED YET
+key: {{key}}
compressed: {{compressed}}
connect-to: {{connect-to}}
delay: {{delay}}
location: {{location}}
+location-trusted: {{location-trusted}}
http1.0: {{http10}}
http1.1: {{http11}}
http2: {{http2}}
@@ -58,16 +60,17 @@ ipv4: {{ipv4}}
ipv6: {{ipv6}}
max-redirs: {{max-redirs}}
netrc: {{netrc}}
-#netrc-file: {{netrc-file}} NOT SUPPORTED YET
+netrc-file: {{netrc-file}}
netrc-optional: {{netrc-optional}}
-#output: {{output}} NOT SUPPORTED YET
+output: {{output}}
path-as-is: {{path-as-is}}
proxy: {{proxy}}
resolve: {{resolve}}
retry: {{retry}}
retry-interval: {{retry-interval}}
skip: {{skip}}
+unix-socket: {{socket-file}}
+user: {{user}}
#variable: {{variable}} NOT SUPPORTED YET
-unix-socket: {{socket_file}}
verbose: {{verbose}}
very-verbose: {{very-verbose}}
diff --git a/integration/hurlfmt/tests_export/options.json b/integration/hurlfmt/tests_export/options.json
index 3691c406f..551e0b33f 100644
--- a/integration/hurlfmt/tests_export/options.json
+++ b/integration/hurlfmt/tests_export/options.json
@@ -1 +1 @@
-{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/hello","options":[{"name":"aws-sigv4","value":"aws:amz:eu-central-1:sts"},{"name":"cacert","value":"cacertfile"},{"name":"cert","value":"certfile"},{"name":"cert","value":"certfile:qU114@q,[\"NO"},{"name":"key","value":"keyfile"},{"name":"compressed","value":false},{"name":"connect-to","value":"example.com:443:example.net:8443"},{"name":"delay","value":1000},{"name":"location","value":false},{"name":"location-trusted","value":false},{"name":"http1.0","value":false},{"name":"http1.1","value":false},{"name":"http2","value":false},{"name":"http3","value":false},{"name":"insecure","value":false},{"name":"ipv4","value":false},{"name":"ipv6","value":false},{"name":"max-redirs","value":10},{"name":"netrc","value":false},{"name":"netrc-file","value":"netrcfile"},{"name":"netrc-optional","value":false},{"name":"output","value":"output.txt"},{"name":"path-as-is","value":false},{"name":"proxy","value":"http://proxy.example"},{"name":"resolve","value":"example.com:443:127.0.0.1"},{"name":"retry","value":0},{"name":"retry","value":-1},{"name":"retry","value":4},{"name":"retry-interval","value":1000},{"name":"skip","value":false},{"name":"unix-socket","value":"build/unix_socket.sock"},{"name":"variable","value":"user=null"},{"name":"variable","value":"status=true"},{"name":"variable","value":"count=2"},{"name":"variable","value":"score=7.7"},{"name":"variable","value":"name=Bob"},{"name":"verbose","value":false},{"name":"very-verbose","value":false}]}},{"request":{"method":"GET","url":"http://localhost:8000/hello","options":[{"name":"aws-sigv4","value":"{{aws-sigv4}}"},{"name":"cert","value":"{{cert}}"},{"name":"compressed","value":"{{compressed}}"},{"name":"connect-to","value":"{{connect-to}}"},{"name":"delay","value":"{{delay}}"},{"name":"location","value":"{{location}}"},{"name":"http1.0","value":"{{http10}}"},{"name":"http1.1","value":"{{http11}}"},{"name":"http2","value":"{{http2}}"},{"name":"http3","value":"{{http3}}"},{"name":"insecure","value":"{{insecure}}"},{"name":"ipv4","value":"{{ipv4}}"},{"name":"ipv6","value":"{{ipv6}}"},{"name":"max-redirs","value":"{{max-redirs}}"},{"name":"netrc","value":"{{netrc}}"},{"name":"netrc-optional","value":"{{netrc-optional}}"},{"name":"path-as-is","value":"{{path-as-is}}"},{"name":"proxy","value":"{{proxy}}"},{"name":"resolve","value":"{{resolve}}"},{"name":"retry","value":"{{retry}}"},{"name":"retry-interval","value":"{{retry-interval}}"},{"name":"skip","value":"{{skip}}"},{"name":"unix-socket","value":"{{socket_file}}"},{"name":"verbose","value":"{{verbose}}"},{"name":"very-verbose","value":"{{very-verbose}}"}]}}]}
+{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/hello","options":[{"name":"aws-sigv4","value":"aws:amz:eu-central-1:sts"},{"name":"cacert","value":"cacertfile"},{"name":"cert","value":"certfile"},{"name":"cert","value":"certfile:qU114@q,[\"NO"},{"name":"key","value":"keyfile"},{"name":"compressed","value":false},{"name":"connect-to","value":"example.com:443:example.net:8443"},{"name":"delay","value":1000},{"name":"location","value":false},{"name":"location-trusted","value":false},{"name":"http1.0","value":false},{"name":"http1.1","value":false},{"name":"http2","value":false},{"name":"http3","value":false},{"name":"insecure","value":false},{"name":"ipv4","value":false},{"name":"ipv6","value":false},{"name":"max-redirs","value":10},{"name":"netrc","value":false},{"name":"netrc-file","value":"netrcfile"},{"name":"netrc-optional","value":false},{"name":"output","value":"output.txt"},{"name":"path-as-is","value":false},{"name":"proxy","value":"http://proxy.example"},{"name":"resolve","value":"example.com:443:127.0.0.1"},{"name":"retry","value":0},{"name":"retry","value":-1},{"name":"retry","value":4},{"name":"retry-interval","value":1000},{"name":"skip","value":false},{"name":"unix-socket","value":"build/unix_socket.sock"},{"name":"user","value":"bob:secret"},{"name":"variable","value":"user=null"},{"name":"variable","value":"status=true"},{"name":"variable","value":"count=2"},{"name":"variable","value":"score=7.7"},{"name":"variable","value":"name=Bob"},{"name":"verbose","value":false},{"name":"very-verbose","value":false}]}},{"request":{"method":"GET","url":"http://localhost:8000/hello","options":[{"name":"aws-sigv4","value":"{{aws-sigv4}}"},{"name":"cacert","value":"{{cacert}}"},{"name":"cert","value":"{{cert}}"},{"name":"key","value":"{{key}}"},{"name":"compressed","value":"{{compressed}}"},{"name":"connect-to","value":"{{connect-to}}"},{"name":"delay","value":"{{delay}}"},{"name":"location","value":"{{location}}"},{"name":"location-trusted","value":"{{location-trusted}}"},{"name":"http1.0","value":"{{http10}}"},{"name":"http1.1","value":"{{http11}}"},{"name":"http2","value":"{{http2}}"},{"name":"http3","value":"{{http3}}"},{"name":"insecure","value":"{{insecure}}"},{"name":"ipv4","value":"{{ipv4}}"},{"name":"ipv6","value":"{{ipv6}}"},{"name":"max-redirs","value":"{{max-redirs}}"},{"name":"netrc","value":"{{netrc}}"},{"name":"netrc-file","value":"{{netrc-file}}"},{"name":"netrc-optional","value":"{{netrc-optional}}"},{"name":"output","value":"{{output}}"},{"name":"path-as-is","value":"{{path-as-is}}"},{"name":"proxy","value":"{{proxy}}"},{"name":"resolve","value":"{{resolve}}"},{"name":"retry","value":"{{retry}}"},{"name":"retry-interval","value":"{{retry-interval}}"},{"name":"skip","value":"{{skip}}"},{"name":"unix-socket","value":"{{socket-file}}"},{"name":"user","value":"{{user}}"},{"name":"verbose","value":"{{verbose}}"},{"name":"very-verbose","value":"{{very-verbose}}"}]}}]}
diff --git a/integration/hurlfmt/tests_export/options.lint.hurl b/integration/hurlfmt/tests_export/options.lint.hurl
index 1ed92b81e..1c03cebb5 100644
--- a/integration/hurlfmt/tests_export/options.lint.hurl
+++ b/integration/hurlfmt/tests_export/options.lint.hurl
@@ -31,6 +31,7 @@ retry: 4
retry-interval: 1000
skip: false
unix-socket: build/unix_socket.sock
+user: bob:secret
variable: user=null
variable: status=true
variable: count=2
@@ -42,13 +43,14 @@ very-verbose: false
GET http://localhost:8000/hello
[Options]
aws-sigv4: {{aws-sigv4}}
-#cacert: {{cacert}} NOT SUPPORTED YET
+cacert: {{cacert}}
cert: {{cert}}
-#key: {{key}} NOT SUPPORTED YET
+key: {{key}}
compressed: {{compressed}}
connect-to: {{connect-to}}
delay: {{delay}}
location: {{location}}
+location-trusted: {{location-trusted}}
http1.0: {{http10}}
http1.1: {{http11}}
http2: {{http2}}
@@ -58,16 +60,17 @@ ipv4: {{ipv4}}
ipv6: {{ipv6}}
max-redirs: {{max-redirs}}
netrc: {{netrc}}
-#netrc-file: {{netrc-file}} NOT SUPPORTED YET
+netrc-file: {{netrc-file}}
netrc-optional: {{netrc-optional}}
-#output: {{output}} NOT SUPPORTED YET
+output: {{output}}
path-as-is: {{path-as-is}}
proxy: {{proxy}}
resolve: {{resolve}}
retry: {{retry}}
retry-interval: {{retry-interval}}
skip: {{skip}}
+unix-socket: {{socket-file}}
+user: {{user}}
#variable: {{variable}} NOT SUPPORTED YET
-unix-socket: {{socket_file}}
verbose: {{verbose}}
very-verbose: {{very-verbose}}
diff --git a/packages/hurl/README.md b/packages/hurl/README.md
index f7a79d903..e8f9eb9ca 100644
--- a/packages/hurl/README.md
+++ b/packages/hurl/README.md
@@ -549,6 +549,7 @@ jsonpath "$.links" count == 12
jsonpath "$.state" != null
jsonpath "$.order" matches "^order-\\d{8}$"
jsonpath "$.order" matches /^order-\d{8}$/ # Alternative syntax with regex literal
+jsonpath "$.created" isIsoDate
```
[Doc](https://hurl.dev/docs/asserting-response.html#jsonpath-assert)
@@ -988,7 +989,7 @@ will follow a redirection only for the second entry.
| --test
| 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.
This is a cli-only option.
|
| --to-entry <ENTRY_NUMBER>
| Execute Hurl file to ENTRY_NUMBER (starting at 1).
Ignore the remaining of the file. It is useful for debugging a session.
This is a cli-only option.
|
| --unix-socket <PATH>
| (HTTP) Connect through this Unix domain socket, instead of using the network.
|
-| -u, --user <USER:PASSWORD>
| Add basic Authentication header to each request.
This is a cli-only option.
|
+| -u, --user <USER:PASSWORD>
| Add basic Authentication header to each request.
|
| -A, --user-agent <NAME>
| Specify the User-Agent string to send to the HTTP server.
This is a cli-only option.
|
| --variable <NAME=VALUE>
| Define variable (name/value) to be used in Hurl templates.
|
| --variables-file <FILE>
| Set properties file in which your define your variables.
Each variable is defined as name=value exactly as with [`--variable`](#variable) option.
Note that defining a variable twice produces an error.
This is a cli-only option.
|
diff --git a/packages/hurl/src/runner/options.rs b/packages/hurl/src/runner/options.rs
index d322fb493..4a0e898a5 100644
--- a/packages/hurl/src/runner/options.rs
+++ b/packages/hurl/src/runner/options.rs
@@ -172,7 +172,7 @@ pub fn get_entry_options(
}
OptionKind::NetRcFile(value) => {
let filename = eval_template(value, variables)?;
- runner_options.netrc_file = Some(filename.to_string());
+ runner_options.netrc_file = Some(filename);
}
OptionKind::NetRcOptional(value) => {
let value = eval_boolean_option(value, variables)?;
@@ -189,7 +189,7 @@ pub fn get_entry_options(
}
OptionKind::Proxy(value) => {
let value = eval_template(value, variables)?;
- runner_options.proxy = Some(value.to_string());
+ runner_options.proxy = Some(value);
}
OptionKind::Resolve(value) => {
let value = eval_template(value, variables)?;
@@ -209,7 +209,11 @@ pub fn get_entry_options(
}
OptionKind::UnixSocket(value) => {
let value = eval_template(value, variables)?;
- runner_options.unix_socket = Some(value.to_string());
+ runner_options.unix_socket = Some(value);
+ }
+ OptionKind::User(value) => {
+ let value = eval_template(value, variables)?;
+ runner_options.user = Some(value);
}
OptionKind::Variable(VariableDefinition { name, value, .. }) => {
let value = eval_variable_value(value, variables)?;
diff --git a/packages/hurl_core/src/ast/core.rs b/packages/hurl_core/src/ast/core.rs
index 6ef290727..e96cc7f21 100644
--- a/packages/hurl_core/src/ast/core.rs
+++ b/packages/hurl_core/src/ast/core.rs
@@ -740,6 +740,7 @@ pub enum OptionKind {
RetryInterval(NaturalOption),
Skip(BooleanOption),
UnixSocket(Template),
+ User(Template),
Variable(VariableDefinition),
Verbose(BooleanOption),
VeryVerbose(BooleanOption),
@@ -776,6 +777,7 @@ impl OptionKind {
OptionKind::RetryInterval(_) => "retry-interval",
OptionKind::Skip(_) => "skip",
OptionKind::UnixSocket(_) => "unix-socket",
+ OptionKind::User(_) => "user",
OptionKind::Variable(_) => "variable",
OptionKind::Verbose(_) => "verbose",
OptionKind::VeryVerbose(_) => "very-verbose",
@@ -812,6 +814,7 @@ impl OptionKind {
OptionKind::RetryInterval(value) => value.to_string(),
OptionKind::Skip(value) => value.to_string(),
OptionKind::UnixSocket(value) => value.to_string(),
+ OptionKind::User(value) => value.to_string(),
OptionKind::Variable(VariableDefinition { name, value, .. }) => {
format!("{name}={value}")
}
diff --git a/packages/hurl_core/src/format/html.rs b/packages/hurl_core/src/format/html.rs
index 949c8c85c..21033a7dc 100644
--- a/packages/hurl_core/src/format/html.rs
+++ b/packages/hurl_core/src/format/html.rs
@@ -242,6 +242,7 @@ impl HtmlFormatter {
OptionKind::RetryInterval(value) => self.fmt_natural_option(value),
OptionKind::Skip(value) => self.fmt_bool_option(value),
OptionKind::UnixSocket(value) => self.fmt_template(value),
+ OptionKind::User(value) => self.fmt_template(value),
OptionKind::Variable(value) => self.fmt_variable_definition(value),
OptionKind::Verbose(value) => self.fmt_bool_option(value),
OptionKind::VeryVerbose(value) => self.fmt_bool_option(value),
diff --git a/packages/hurl_core/src/parser/option.rs b/packages/hurl_core/src/parser/option.rs
index 3c68f2c3a..b21cfaf6b 100644
--- a/packages/hurl_core/src/parser/option.rs
+++ b/packages/hurl_core/src/parser/option.rs
@@ -15,7 +15,6 @@
* limitations under the License.
*
*/
-
use crate::ast::*;
use crate::parser::combinators::*;
use crate::parser::error::*;
@@ -67,6 +66,7 @@ pub fn parse(reader: &mut Reader) -> ParseResult {
"retry-interval" => option_retry_interval(reader)?,
"skip" => option_skip(reader)?,
"unix-socket" => option_unix_socket(reader)?,
+ "user" => option_user(reader)?,
"variable" => option_variable(reader)?,
"verbose" => option_verbose(reader)?,
"very-verbose" => option_very_verbose(reader)?,
@@ -225,6 +225,11 @@ fn option_skip(reader: &mut Reader) -> ParseResult {
Ok(OptionKind::Skip(value))
}
+fn option_user(reader: &mut Reader) -> ParseResult {
+ let value = unquoted_template(reader)?;
+ Ok(OptionKind::User(value))
+}
+
fn option_unix_socket(reader: &mut Reader) -> ParseResult {
let value = unquoted_template(reader)?;
Ok(OptionKind::UnixSocket(value))
diff --git a/packages/hurlfmt/src/format/json.rs b/packages/hurlfmt/src/format/json.rs
index 964a50d82..c3f8dc7b4 100644
--- a/packages/hurlfmt/src/format/json.rs
+++ b/packages/hurlfmt/src/format/json.rs
@@ -308,6 +308,7 @@ impl ToJson for EntryOption {
OptionKind::RetryInterval(value) => value.to_json(),
OptionKind::Skip(value) => value.to_json(),
OptionKind::UnixSocket(value) => JValue::String(value.to_string()),
+ OptionKind::User(value) => JValue::String(value.to_string()),
OptionKind::Variable(value) => {
JValue::String(format!("{}={}", value.name, value.value))
}
diff --git a/packages/hurlfmt/src/format/token.rs b/packages/hurlfmt/src/format/token.rs
index 459ea421f..1a02d94ad 100644
--- a/packages/hurlfmt/src/format/token.rs
+++ b/packages/hurlfmt/src/format/token.rs
@@ -904,6 +904,7 @@ impl Tokenizable for OptionKind {
OptionKind::RetryInterval(value) => value.tokenize(),
OptionKind::Skip(value) => value.tokenize(),
OptionKind::UnixSocket(value) => value.tokenize(),
+ OptionKind::User(value) => value.tokenize(),
OptionKind::Variable(value) => value.tokenize(),
OptionKind::Verbose(value) => value.tokenize(),
OptionKind::VeryVerbose(value) => value.tokenize(),