Support --user option per request

This commit is contained in:
jcamiel 2024-03-26 15:20:21 +01:00
parent fe15411ffe
commit 32a73ce7a4
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
23 changed files with 73 additions and 50 deletions

View File

@ -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.
| <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>This is a cli-only option.<br> |
| <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> |
| <a href="#unix-socket" id="unix-socket"><code>--unix-socket &lt;PATH&gt;</code></a> | (HTTP) Connect through this Unix domain socket, instead of using the network.<br> |
| <a href="#user" id="user"><code>-u, --user &lt;USER:PASSWORD&gt;</code></a> | Add basic Authentication header to each request.<br><br>This is a cli-only option.<br> |
| <a href="#user" id="user"><code>-u, --user &lt;USER:PASSWORD&gt;</code></a> | Add basic Authentication header to each request.<br> |
| <a href="#user-agent" id="user-agent"><code>-A, --user-agent &lt;NAME&gt;</code></a> | Specify the User-Agent string to send to the HTTP server.<br><br>This is a cli-only option.<br> |
| <a href="#variable" id="variable"><code>--variable &lt;NAME=VALUE&gt;</code></a> | Define variable (name/value) to be used in Hurl templates.<br> |
| <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> |

View File

@ -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

View File

@ -77,7 +77,7 @@ Short description:
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="assert">assert</span><span class="grammar-usedby">(used by <a href="#asserts-section">asserts-section</a>)</span></div><div class="grammar-rule-expression"><a href="#lt">lt</a><span class="grammar-symbol">*</span><br>
<a href="#query">query</a>&nbsp;<span class="grammar-symbol">(</span><a href="#sp">sp</a>&nbsp;<a href="#filter">filter</a><span class="grammar-symbol">)</span><span class="grammar-symbol">*</span>&nbsp;<a href="#sp">sp</a>&nbsp;<a href="#predicate">predicate</a>&nbsp;<a href="#lt">lt</a></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="option">option</span><span class="grammar-usedby">(used by <a href="#options-section">options-section</a>)</span></div><div class="grammar-rule-expression"><a href="#lt">lt</a><span class="grammar-symbol">*</span><br>
<span class="grammar-symbol">(</span><a href="#aws-sigv4-option">aws-sigv4-option</a><span class="grammar-symbol">|</span><a href="#ca-certificate-option">ca-certificate-option</a><span class="grammar-symbol">|</span><a href="#client-certificate-option">client-certificate-option</a><span class="grammar-symbol">|</span><a href="#client-key-option">client-key-option</a><span class="grammar-symbol">|</span><a href="#compressed-option">compressed-option</a><span class="grammar-symbol">|</span><a href="#connect-to-option">connect-to-option</a><span class="grammar-symbol">|</span><a href="#delay-option">delay-option</a><span class="grammar-symbol">|</span><a href="#follow-redirect-option">follow-redirect-option</a><span class="grammar-symbol">|</span><a href="#follow-redirect-trusted-option">follow-redirect-trusted-option</a><span class="grammar-symbol">|</span><a href="#http10-option">http10-option</a><span class="grammar-symbol">|</span><a href="#http11-option">http11-option</a><span class="grammar-symbol">|</span><a href="#http2-option">http2-option</a><span class="grammar-symbol">|</span><a href="#http3-option">http3-option</a><span class="grammar-symbol">|</span><a href="#insecure-option">insecure-option</a><span class="grammar-symbol">|</span><a href="#ipv4-option">ipv4-option</a><span class="grammar-symbol">|</span><a href="#ipv6-option">ipv6-option</a><span class="grammar-symbol">|</span><a href="#max-redirs-option">max-redirs-option</a><span class="grammar-symbol">|</span><a href="#netrc-option">netrc-option</a><span class="grammar-symbol">|</span><a href="#netrc-file-option">netrc-file-option</a><span class="grammar-symbol">|</span><a href="#netrc-optional-option">netrc-optional-option</a><span class="grammar-symbol">|</span><a href="#output-option">output-option</a><span class="grammar-symbol">|</span><a href="#path-as-is-option">path-as-is-option</a><span class="grammar-symbol">|</span><a href="#proxy-option">proxy-option</a><span class="grammar-symbol">|</span><a href="#resolve-option">resolve-option</a><span class="grammar-symbol">|</span><a href="#retry-option">retry-option</a><span class="grammar-symbol">|</span><a href="#retry-interval-option">retry-interval-option</a><span class="grammar-symbol">|</span><a href="#skip-option">skip-option</a><span class="grammar-symbol">|</span><a href="#unix-socket-option">unix-socket-option</a><span class="grammar-symbol">|</span><a href="#variable-option">variable-option</a><span class="grammar-symbol">|</span><a href="#verbose-option">verbose-option</a><span class="grammar-symbol">|</span><a href="#very-verbose-option">very-verbose-option</a><span class="grammar-symbol">)</span></div></div>
<span class="grammar-symbol">(</span><a href="#aws-sigv4-option">aws-sigv4-option</a><span class="grammar-symbol">|</span><a href="#ca-certificate-option">ca-certificate-option</a><span class="grammar-symbol">|</span><a href="#client-certificate-option">client-certificate-option</a><span class="grammar-symbol">|</span><a href="#client-key-option">client-key-option</a><span class="grammar-symbol">|</span><a href="#compressed-option">compressed-option</a><span class="grammar-symbol">|</span><a href="#connect-to-option">connect-to-option</a><span class="grammar-symbol">|</span><a href="#delay-option">delay-option</a><span class="grammar-symbol">|</span><a href="#follow-redirect-option">follow-redirect-option</a><span class="grammar-symbol">|</span><a href="#follow-redirect-trusted-option">follow-redirect-trusted-option</a><span class="grammar-symbol">|</span><a href="#http10-option">http10-option</a><span class="grammar-symbol">|</span><a href="#http11-option">http11-option</a><span class="grammar-symbol">|</span><a href="#http2-option">http2-option</a><span class="grammar-symbol">|</span><a href="#http3-option">http3-option</a><span class="grammar-symbol">|</span><a href="#insecure-option">insecure-option</a><span class="grammar-symbol">|</span><a href="#ipv4-option">ipv4-option</a><span class="grammar-symbol">|</span><a href="#ipv6-option">ipv6-option</a><span class="grammar-symbol">|</span><a href="#max-redirs-option">max-redirs-option</a><span class="grammar-symbol">|</span><a href="#netrc-option">netrc-option</a><span class="grammar-symbol">|</span><a href="#netrc-file-option">netrc-file-option</a><span class="grammar-symbol">|</span><a href="#netrc-optional-option">netrc-optional-option</a><span class="grammar-symbol">|</span><a href="#output-option">output-option</a><span class="grammar-symbol">|</span><a href="#path-as-is-option">path-as-is-option</a><span class="grammar-symbol">|</span><a href="#proxy-option">proxy-option</a><span class="grammar-symbol">|</span><a href="#resolve-option">resolve-option</a><span class="grammar-symbol">|</span><a href="#retry-option">retry-option</a><span class="grammar-symbol">|</span><a href="#retry-interval-option">retry-interval-option</a><span class="grammar-symbol">|</span><a href="#skip-option">skip-option</a><span class="grammar-symbol">|</span><a href="#unix-socket-option">unix-socket-option</a><span class="grammar-symbol">|</span><a href="#user-option">user-option</a><span class="grammar-symbol">|</span><a href="#variable-option">variable-option</a><span class="grammar-symbol">|</span><a href="#verbose-option">verbose-option</a><span class="grammar-symbol">|</span><a href="#very-verbose-option">very-verbose-option</a><span class="grammar-symbol">)</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="aws-sigv4-option">aws-sigv4-option</span><span class="grammar-usedby">(used by <a href="#option">option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">aws-sigv4</span>&nbsp;<span class="grammar-literal">:</span>&nbsp;<a href="#value-string">value-string</a>&nbsp;<a href="#lt">lt</a></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="ca-certificate-option">ca-certificate-option</span><span class="grammar-usedby">(used by <a href="#option">option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">cacert</span>&nbsp;<span class="grammar-literal">:</span>&nbsp;<a href="#filename">filename</a>&nbsp;<a href="#lt">lt</a></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="client-certificate-option">client-certificate-option</span><span class="grammar-usedby">(used by <a href="#option">option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">cert</span>&nbsp;<span class="grammar-literal">:</span>&nbsp;<a href="#filename-password">filename-password</a>&nbsp;<a href="#lt">lt</a></div></div>
@ -106,6 +106,7 @@ Short description:
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="retry-interval-option">retry-interval-option</span><span class="grammar-usedby">(used by <a href="#option">option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">retry-interval</span>&nbsp;<span class="grammar-literal">:</span>&nbsp;<a href="#integer-option">integer-option</a>&nbsp;<a href="#lt">lt</a></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="skip-option">skip-option</span><span class="grammar-usedby">(used by <a href="#option">option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">skip</span>&nbsp;<span class="grammar-literal">:</span>&nbsp;<a href="#boolean-option">boolean-option</a>&nbsp;<a href="#lt">lt</a></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="unix-socket-option">unix-socket-option</span><span class="grammar-usedby">(used by <a href="#option">option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">unix-socket</span>&nbsp;<span class="grammar-literal">:</span>&nbsp;<a href="#value-string">value-string</a>&nbsp;<a href="#lt">lt</a></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="user-option">user-option</span><span class="grammar-usedby">(used by <a href="#option">option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">user</span>&nbsp;<span class="grammar-literal">:</span>&nbsp;<a href="#value-string">value-string</a>&nbsp;<a href="#lt">lt</a></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="variable-option">variable-option</span><span class="grammar-usedby">(used by <a href="#option">option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">variable</span>&nbsp;<span class="grammar-literal">:</span>&nbsp;<a href="#variable-definition">variable-definition</a>&nbsp;<a href="#lt">lt</a></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="verbose-option">verbose-option</span><span class="grammar-usedby">(used by <a href="#option">option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">verbose</span>&nbsp;<span class="grammar-literal">:</span>&nbsp;<a href="#boolean-option">boolean-option</a>&nbsp;<a href="#lt">lt</a></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="very-verbose-option">very-verbose-option</span><span class="grammar-usedby">(used by <a href="#option">option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">very-verbose</span>&nbsp;<span class="grammar-literal">:</span>&nbsp;<a href="#boolean-option">boolean-option</a>&nbsp;<a href="#lt">lt</a></div></div>
@ -215,7 +216,7 @@ Short description:
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="key-string-content">key-string-content</span><span class="grammar-usedby">(used by <a href="#key-string">key-string</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-symbol">(</span><a href="#key-string-text">key-string-text</a><span class="grammar-symbol">|</span><a href="#key-string-escaped-char">key-string-escaped-char</a><span class="grammar-symbol">)</span><span class="grammar-symbol">*</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="key-string-text">key-string-text</span><span class="grammar-usedby">(used by <a href="#key-string-content">key-string-content</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-symbol">(</span><a href="#alphanum">alphanum</a><span class="grammar-symbol">|</span><span class="grammar-literal">_</span><span class="grammar-symbol">|</span><span class="grammar-literal">-</span><span class="grammar-symbol">|</span><span class="grammar-literal">.</span><span class="grammar-symbol">|</span><span class="grammar-literal">[</span><span class="grammar-symbol">|</span><span class="grammar-literal">]</span><span class="grammar-symbol">|</span><span class="grammar-literal">@</span><span class="grammar-symbol">|</span><span class="grammar-literal">$</span><span class="grammar-symbol">)</span><span class="grammar-symbol">+</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="key-string-escaped-char">key-string-escaped-char</span><span class="grammar-usedby">(used by <a href="#key-string-content">key-string-content</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">\</span>&nbsp;<span class="grammar-symbol">(</span><span class="grammar-literal">#</span><span class="grammar-symbol">|</span><span class="grammar-literal">:</span><span class="grammar-symbol">|</span><span class="grammar-literal">\</span><span class="grammar-symbol">|</span><span class="grammar-literal">\b</span><span class="grammar-symbol">|</span><span class="grammar-literal">\f</span><span class="grammar-symbol">|</span><span class="grammar-literal">\n</span><span class="grammar-symbol">|</span><span class="grammar-literal">\r</span><span class="grammar-symbol">|</span><span class="grammar-literal">\t</span><span class="grammar-symbol">|</span><span class="grammar-literal">\u</span>&nbsp;<a href="#unicode-char">unicode-char</a><span class="grammar-symbol">)</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="value-string">value-string</span><span class="grammar-usedby">(used by <a href="#request">request</a>,&nbsp;<a href="#key-value">key-value</a>,&nbsp;<a href="#aws-sigv4-option">aws-sigv4-option</a>,&nbsp;<a href="#client-key-option">client-key-option</a>,&nbsp;<a href="#connect-to-option">connect-to-option</a>,&nbsp;<a href="#netrc-file-option">netrc-file-option</a>,&nbsp;<a href="#output-option">output-option</a>,&nbsp;<a href="#proxy-option">proxy-option</a>,&nbsp;<a href="#resolve-option">resolve-option</a>,&nbsp;<a href="#unix-socket-option">unix-socket-option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-symbol">(</span><a href="#value-string-content">value-string-content</a><span class="grammar-symbol">|</span><a href="#template">template</a><span class="grammar-symbol">)</span><span class="grammar-symbol">*</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="value-string">value-string</span><span class="grammar-usedby">(used by <a href="#request">request</a>,&nbsp;<a href="#key-value">key-value</a>,&nbsp;<a href="#aws-sigv4-option">aws-sigv4-option</a>,&nbsp;<a href="#client-key-option">client-key-option</a>,&nbsp;<a href="#connect-to-option">connect-to-option</a>,&nbsp;<a href="#netrc-file-option">netrc-file-option</a>,&nbsp;<a href="#output-option">output-option</a>,&nbsp;<a href="#proxy-option">proxy-option</a>,&nbsp;<a href="#resolve-option">resolve-option</a>,&nbsp;<a href="#unix-socket-option">unix-socket-option</a>,&nbsp;<a href="#user-option">user-option</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-symbol">(</span><a href="#value-string-content">value-string-content</a><span class="grammar-symbol">|</span><a href="#template">template</a><span class="grammar-symbol">)</span><span class="grammar-symbol">*</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="value-string-content">value-string-content</span><span class="grammar-usedby">(used by <a href="#value-string">value-string</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-symbol">(</span><a href="#value-string-text">value-string-text</a><span class="grammar-symbol">|</span><a href="#value-string-escaped-char">value-string-escaped-char</a><span class="grammar-symbol">)</span><span class="grammar-symbol">*</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="value-string-text">value-string-text</span><span class="grammar-usedby">(used by <a href="#value-string-content">value-string-content</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-regex">~[#\n\\]+</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="value-string-escaped-char">value-string-escaped-char</span><span class="grammar-usedby">(used by <a href="#value-string-content">value-string-content</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">\</span>&nbsp;<span class="grammar-symbol">(</span><span class="grammar-literal">#</span><span class="grammar-symbol">|</span><span class="grammar-literal">\</span><span class="grammar-symbol">|</span><span class="grammar-literal">\b</span><span class="grammar-symbol">|</span><span class="grammar-literal">\f</span><span class="grammar-symbol">|</span><span class="grammar-literal">\n</span><span class="grammar-symbol">|</span><span class="grammar-literal">\r</span><span class="grammar-symbol">|</span><span class="grammar-literal">\t</span><span class="grammar-symbol">|</span><span class="grammar-literal">\u</span>&nbsp;<a href="#unicode-char">unicode-char</a><span class="grammar-symbol">)</span></div></div>
@ -306,7 +307,7 @@ Short description:
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="fraction">fraction</span><span class="grammar-usedby">(used by <a href="#json-number">json-number</a>,&nbsp;<a href="#float">float</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">.</span>&nbsp;<a href="#digit">digit</a><span class="grammar-symbol">+</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="exponent">exponent</span><span class="grammar-usedby">(used by <a href="#json-number">json-number</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-symbol">(</span><span class="grammar-literal">e</span><span class="grammar-symbol">|</span><span class="grammar-literal">E</span><span class="grammar-symbol">)</span>&nbsp;<span class="grammar-symbol">(</span><span class="grammar-literal">+</span><span class="grammar-symbol">|</span><span class="grammar-literal">-</span><span class="grammar-symbol">)</span><span class="grammar-symbol">?</span>&nbsp;<a href="#digit">digit</a><span class="grammar-symbol">+</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="sp">sp</span><span class="grammar-usedby">(used by <a href="#request">request</a>,&nbsp;<a href="#response">response</a>,&nbsp;<a href="#capture">capture</a>,&nbsp;<a href="#assert">assert</a>,&nbsp;<a href="#header-query">header-query</a>,&nbsp;<a href="#certificate-query">certificate-query</a>,&nbsp;<a href="#cookie-query">cookie-query</a>,&nbsp;<a href="#xpath-query">xpath-query</a>,&nbsp;<a href="#jsonpath-query">jsonpath-query</a>,&nbsp;<a href="#regex-query">regex-query</a>,&nbsp;<a href="#variable-query">variable-query</a>,&nbsp;<a href="#predicate">predicate</a>,&nbsp;<a href="#equal-predicate">equal-predicate</a>,&nbsp;<a href="#not-equal-predicate">not-equal-predicate</a>,&nbsp;<a href="#greater-predicate">greater-predicate</a>,&nbsp;<a href="#greater-or-equal-predicate">greater-or-equal-predicate</a>,&nbsp;<a href="#less-predicate">less-predicate</a>,&nbsp;<a href="#less-or-equal-predicate">less-or-equal-predicate</a>,&nbsp;<a href="#start-with-predicate">start-with-predicate</a>,&nbsp;<a href="#end-with-predicate">end-with-predicate</a>,&nbsp;<a href="#contain-predicate">contain-predicate</a>,&nbsp;<a href="#match-predicate">match-predicate</a>,&nbsp;<a href="#include-predicate">include-predicate</a>,&nbsp;<a href="#expr">expr</a>,&nbsp;<a href="#jsonpath-filter">jsonpath-filter</a>,&nbsp;<a href="#nth-filter">nth-filter</a>,&nbsp;<a href="#regex-filter">regex-filter</a>,&nbsp;<a href="#replace-filter">replace-filter</a>,&nbsp;<a href="#split-filter">split-filter</a>,&nbsp;<a href="#xpath-filter">xpath-filter</a>,&nbsp;<a href="#lt">lt</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-regex">[ \t]</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="lt">lt</span><span class="grammar-usedby">(used by <a href="#hurl-file">hurl-file</a>,&nbsp;<a href="#request">request</a>,&nbsp;<a href="#response">response</a>,&nbsp;<a href="#header">header</a>,&nbsp;<a href="#body">body</a>,&nbsp;<a href="#query-string-params-section">query-string-params-section</a>,&nbsp;<a href="#form-params-section">form-params-section</a>,&nbsp;<a href="#multipart-form-data-section">multipart-form-data-section</a>,&nbsp;<a href="#cookies-section">cookies-section</a>,&nbsp;<a href="#captures-section">captures-section</a>,&nbsp;<a href="#asserts-section">asserts-section</a>,&nbsp;<a href="#basic-auth-section">basic-auth-section</a>,&nbsp;<a href="#options-section">options-section</a>,&nbsp;<a href="#file-param">file-param</a>,&nbsp;<a href="#capture">capture</a>,&nbsp;<a href="#assert">assert</a>,&nbsp;<a href="#option">option</a>,&nbsp;<a href="#aws-sigv4-option">aws-sigv4-option</a>,&nbsp;<a href="#ca-certificate-option">ca-certificate-option</a>,&nbsp;<a href="#client-certificate-option">client-certificate-option</a>,&nbsp;<a href="#client-key-option">client-key-option</a>,&nbsp;<a href="#compressed-option">compressed-option</a>,&nbsp;<a href="#connect-to-option">connect-to-option</a>,&nbsp;<a href="#delay-option">delay-option</a>,&nbsp;<a href="#follow-redirect-option">follow-redirect-option</a>,&nbsp;<a href="#follow-redirect-trusted-option">follow-redirect-trusted-option</a>,&nbsp;<a href="#http10-option">http10-option</a>,&nbsp;<a href="#http11-option">http11-option</a>,&nbsp;<a href="#http2-option">http2-option</a>,&nbsp;<a href="#http3-option">http3-option</a>,&nbsp;<a href="#insecure-option">insecure-option</a>,&nbsp;<a href="#ipv4-option">ipv4-option</a>,&nbsp;<a href="#ipv6-option">ipv6-option</a>,&nbsp;<a href="#max-redirs-option">max-redirs-option</a>,&nbsp;<a href="#netrc-option">netrc-option</a>,&nbsp;<a href="#netrc-file-option">netrc-file-option</a>,&nbsp;<a href="#netrc-optional-option">netrc-optional-option</a>,&nbsp;<a href="#output-option">output-option</a>,&nbsp;<a href="#path-as-is-option">path-as-is-option</a>,&nbsp;<a href="#proxy-option">proxy-option</a>,&nbsp;<a href="#resolve-option">resolve-option</a>,&nbsp;<a href="#retry-option">retry-option</a>,&nbsp;<a href="#retry-interval-option">retry-interval-option</a>,&nbsp;<a href="#skip-option">skip-option</a>,&nbsp;<a href="#unix-socket-option">unix-socket-option</a>,&nbsp;<a href="#variable-option">variable-option</a>,&nbsp;<a href="#verbose-option">verbose-option</a>,&nbsp;<a href="#very-verbose-option">very-verbose-option</a>,&nbsp;<a href="#multiline-string">multiline-string</a>)</span></div><div class="grammar-rule-expression"><a href="#sp">sp</a><span class="grammar-symbol">*</span>&nbsp;<a href="#comment">comment</a><span class="grammar-symbol">?</span>&nbsp;<span class="grammar-regex">[\n]?</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="lt">lt</span><span class="grammar-usedby">(used by <a href="#hurl-file">hurl-file</a>,&nbsp;<a href="#request">request</a>,&nbsp;<a href="#response">response</a>,&nbsp;<a href="#header">header</a>,&nbsp;<a href="#body">body</a>,&nbsp;<a href="#query-string-params-section">query-string-params-section</a>,&nbsp;<a href="#form-params-section">form-params-section</a>,&nbsp;<a href="#multipart-form-data-section">multipart-form-data-section</a>,&nbsp;<a href="#cookies-section">cookies-section</a>,&nbsp;<a href="#captures-section">captures-section</a>,&nbsp;<a href="#asserts-section">asserts-section</a>,&nbsp;<a href="#basic-auth-section">basic-auth-section</a>,&nbsp;<a href="#options-section">options-section</a>,&nbsp;<a href="#file-param">file-param</a>,&nbsp;<a href="#capture">capture</a>,&nbsp;<a href="#assert">assert</a>,&nbsp;<a href="#option">option</a>,&nbsp;<a href="#aws-sigv4-option">aws-sigv4-option</a>,&nbsp;<a href="#ca-certificate-option">ca-certificate-option</a>,&nbsp;<a href="#client-certificate-option">client-certificate-option</a>,&nbsp;<a href="#client-key-option">client-key-option</a>,&nbsp;<a href="#compressed-option">compressed-option</a>,&nbsp;<a href="#connect-to-option">connect-to-option</a>,&nbsp;<a href="#delay-option">delay-option</a>,&nbsp;<a href="#follow-redirect-option">follow-redirect-option</a>,&nbsp;<a href="#follow-redirect-trusted-option">follow-redirect-trusted-option</a>,&nbsp;<a href="#http10-option">http10-option</a>,&nbsp;<a href="#http11-option">http11-option</a>,&nbsp;<a href="#http2-option">http2-option</a>,&nbsp;<a href="#http3-option">http3-option</a>,&nbsp;<a href="#insecure-option">insecure-option</a>,&nbsp;<a href="#ipv4-option">ipv4-option</a>,&nbsp;<a href="#ipv6-option">ipv6-option</a>,&nbsp;<a href="#max-redirs-option">max-redirs-option</a>,&nbsp;<a href="#netrc-option">netrc-option</a>,&nbsp;<a href="#netrc-file-option">netrc-file-option</a>,&nbsp;<a href="#netrc-optional-option">netrc-optional-option</a>,&nbsp;<a href="#output-option">output-option</a>,&nbsp;<a href="#path-as-is-option">path-as-is-option</a>,&nbsp;<a href="#proxy-option">proxy-option</a>,&nbsp;<a href="#resolve-option">resolve-option</a>,&nbsp;<a href="#retry-option">retry-option</a>,&nbsp;<a href="#retry-interval-option">retry-interval-option</a>,&nbsp;<a href="#skip-option">skip-option</a>,&nbsp;<a href="#unix-socket-option">unix-socket-option</a>,&nbsp;<a href="#user-option">user-option</a>,&nbsp;<a href="#variable-option">variable-option</a>,&nbsp;<a href="#verbose-option">verbose-option</a>,&nbsp;<a href="#very-verbose-option">very-verbose-option</a>,&nbsp;<a href="#multiline-string">multiline-string</a>)</span></div><div class="grammar-rule-expression"><a href="#sp">sp</a><span class="grammar-symbol">*</span>&nbsp;<a href="#comment">comment</a><span class="grammar-symbol">?</span>&nbsp;<span class="grammar-regex">[\n]?</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="comment">comment</span><span class="grammar-usedby">(used by <a href="#lt">lt</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">#</span>&nbsp;<span class="grammar-regex">~[\n]*</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="regex">regex</span><span class="grammar-usedby">(used by <a href="#regex-query">regex-query</a>,&nbsp;<a href="#match-predicate">match-predicate</a>,&nbsp;<a href="#regex-filter">regex-filter</a>,&nbsp;<a href="#replace-filter">replace-filter</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-literal">/</span>&nbsp;<a href="#regex-content">regex-content</a>&nbsp;<span class="grammar-literal">/</span></div></div>
<div class="grammar-rule"><div class="grammar-rule-declaration"><span class="grammar-rule-id" id="regex-content">regex-content</span><span class="grammar-usedby">(used by <a href="#regex">regex</a>)</span></div><div class="grammar-rule-expression"><span class="grammar-symbol">(</span><a href="#regex-text">regex-text</a><span class="grammar-symbol">|</span><a href="#regex-escaped-char">regex-escaped-char</a><span class="grammar-symbol">)</span><span class="grammar-symbol">*</span></div></div>

View File

@ -198,7 +198,7 @@ will follow a redirection only for the second entry.
| <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>This is a cli-only option.<br> |
| <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> |
| <a href="#unix-socket" id="unix-socket"><code>--unix-socket &lt;PATH&gt;</code></a> | (HTTP) Connect through this Unix domain socket, instead of using the network.<br> |
| <a href="#user" id="user"><code>-u, --user &lt;USER:PASSWORD&gt;</code></a> | Add basic Authentication header to each request.<br><br>This is a cli-only option.<br> |
| <a href="#user" id="user"><code>-u, --user &lt;USER:PASSWORD&gt;</code></a> | Add basic Authentication header to each request.<br> |
| <a href="#user-agent" id="user-agent"><code>-A, --user-agent &lt;NAME&gt;</code></a> | Specify the User-Agent string to send to the HTTP server.<br><br>This is a cli-only option.<br> |
| <a href="#variable" id="variable"><code>--variable &lt;NAME=VALUE&gt;</code></a> | Define variable (name/value) to be used in Hurl templates.<br> |
| <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> |

View File

@ -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 <NAME> "
Specify the User-Agent string to send to the HTTP server.

View File

@ -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 <NAME> {#user-agent}
Specify the User-Agent string to send to the HTTP server.

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -31,6 +31,7 @@
<span class="line"><span class="string">retry-interval</span>: <span class="number">1000</span></span>
<span class="line"><span class="string">skip</span>: <span class="boolean">false</span></span>
<span class="line"><span class="string">unix-socket</span>: <span class="string">build/unix_socket.sock</span></span>
<span class="line"><span class="string">user</span>: <span class="string">bob:secret</span></span>
<span class="line"><span class="string">variable</span>: user=<span class="null">null</span></span>
<span class="line"><span class="string">variable</span>: status=<span class="boolean">true</span></span>
<span class="line"><span class="string">variable</span>: count=<span class="number">2</span></span>
@ -42,13 +43,14 @@
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/hello</span></span>
<span class="line"><span class="section-header">[Options]</span></span>
<span class="line"><span class="string">aws-sigv4</span>: <span class="string">{{aws-sigv4}}</span></span>
<span class="line"></span><span class="comment">#cacert: {{cacert}} NOT SUPPORTED YET</span>
<span class="line"><span class="string">cacert</span>: <span class="filename">{{cacert}}</span></span>
<span class="line"><span class="string">cert</span>: <span class="filename">{{cert}}</span></span>
<span class="line"></span><span class="comment">#key: {{key}} NOT SUPPORTED YET</span>
<span class="line"><span class="string">key</span>: <span class="filename">{{key}}</span></span>
<span class="line"><span class="string">compressed</span>: <span class="expr">{{compressed}}</span></span>
<span class="line"><span class="string">connect-to</span>: <span class="string">{{connect-to}}</span></span>
<span class="line"><span class="string">delay</span>: <span class="expr">{{delay}}</span></span>
<span class="line"><span class="string">location</span>: <span class="expr">{{location}}</span></span>
<span class="line"><span class="string">location-trusted</span>: <span class="expr">{{location-trusted}}</span></span>
<span class="line"><span class="string">http1.0</span>: <span class="expr">{{http10}}</span></span>
<span class="line"><span class="string">http1.1</span>: <span class="expr">{{http11}}</span></span>
<span class="line"><span class="string">http2</span>: <span class="expr">{{http2}}</span></span>
@ -58,17 +60,18 @@
<span class="line"><span class="string">ipv6</span>: <span class="expr">{{ipv6}}</span></span>
<span class="line"><span class="string">max-redirs</span>: <span class="expr">{{max-redirs}}</span></span>
<span class="line"><span class="string">netrc</span>: <span class="expr">{{netrc}}</span></span>
<span class="line"></span><span class="comment">#netrc-file: {{netrc-file}} NOT SUPPORTED YET</span>
<span class="line"><span class="string">netrc-file</span>: <span class="filename">{{netrc-file}}</span></span>
<span class="line"><span class="string">netrc-optional</span>: <span class="expr">{{netrc-optional}}</span></span>
<span class="line"></span><span class="comment">#output: {{output}} NOT SUPPORTED YET</span>
<span class="line"><span class="string">output</span>: <span class="filename">{{output}}</span></span>
<span class="line"><span class="string">path-as-is</span>: <span class="expr">{{path-as-is}}</span></span>
<span class="line"><span class="string">proxy</span>: <span class="string">{{proxy}}</span></span>
<span class="line"><span class="string">resolve</span>: <span class="string">{{resolve}}</span></span>
<span class="line"><span class="string">retry</span>: <span class="expr">{{retry}}</span></span>
<span class="line"><span class="string">retry-interval</span>: <span class="expr">{{retry-interval}}</span></span>
<span class="line"><span class="string">skip</span>: <span class="expr">{{skip}}</span></span>
<span class="line"><span class="string">unix-socket</span>: <span class="string">{{socket-file}}</span></span>
<span class="line"><span class="string">user</span>: <span class="string">{{user}}</span></span>
<span class="line"></span><span class="comment">#variable: {{variable}} NOT SUPPORTED YET</span>
<span class="line"><span class="string">unix-socket</span>: <span class="string">{{socket_file}}</span></span>
<span class="line"><span class="string">verbose</span>: <span class="expr">{{verbose}}</span></span>
<span class="line"><span class="string">very-verbose</span>: <span class="expr">{{very-verbose}}</span></span>
</span></span></code></pre>

View File

@ -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}}

View File

@ -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}}"}]}}]}

View File

@ -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}}

View File

@ -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.
| <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>This is a cli-only option.<br> |
| <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> |
| <a href="#unix-socket" id="unix-socket"><code>--unix-socket &lt;PATH&gt;</code></a> | (HTTP) Connect through this Unix domain socket, instead of using the network.<br> |
| <a href="#user" id="user"><code>-u, --user &lt;USER:PASSWORD&gt;</code></a> | Add basic Authentication header to each request.<br><br>This is a cli-only option.<br> |
| <a href="#user" id="user"><code>-u, --user &lt;USER:PASSWORD&gt;</code></a> | Add basic Authentication header to each request.<br> |
| <a href="#user-agent" id="user-agent"><code>-A, --user-agent &lt;NAME&gt;</code></a> | Specify the User-Agent string to send to the HTTP server.<br><br>This is a cli-only option.<br> |
| <a href="#variable" id="variable"><code>--variable &lt;NAME=VALUE&gt;</code></a> | Define variable (name/value) to be used in Hurl templates.<br> |
| <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> |

View File

@ -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)?;

View File

@ -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}")
}

View File

@ -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),

View File

@ -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<EntryOption> {
"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<OptionKind> {
Ok(OptionKind::Skip(value))
}
fn option_user(reader: &mut Reader) -> ParseResult<OptionKind> {
let value = unquoted_template(reader)?;
Ok(OptionKind::User(value))
}
fn option_unix_socket(reader: &mut Reader) -> ParseResult<OptionKind> {
let value = unquoted_template(reader)?;
Ok(OptionKind::UnixSocket(value))

View File

@ -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))
}

View File

@ -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(),