Newline added at the end of the files

hurlfmt now also outputs a trailing newline.
This commit is contained in:
Fabrice Reix 2022-10-24 11:37:11 +02:00
parent 1419e706fd
commit bf79a512e0
No known key found for this signature in database
GPG Key ID: BF5213154B2E7155
239 changed files with 284 additions and 186 deletions

View File

@ -25,7 +25,7 @@ def test(format_type, hurl_file):
cmd = ["hurlfmt", "--format", format_type, hurl_file] cmd = ["hurlfmt", "--format", format_type, hurl_file]
print(" ".join(cmd)) print(" ".join(cmd))
result = subprocess.run(cmd, stdout=subprocess.PIPE) result = subprocess.run(cmd, stdout=subprocess.PIPE)
expected = open(output_file, encoding="utf-8").read().strip() expected = open(output_file, encoding="utf-8").read()
actual = decode_string(result.stdout) actual = decode_string(result.stdout)
if actual != expected: if actual != expected:
print(f">>> error in stdout for {format_type}") print(f">>> error in stdout for {format_type}")

View File

@ -16,7 +16,7 @@ def test(html_file):
expected = codecs.open( expected = codecs.open(
hurl_file, encoding="utf-8-sig" hurl_file, encoding="utf-8-sig"
).read() # Input file can be saved with a BOM ).read() # Input file can be saved with a BOM
if actual != expected: if actual.strip() != expected.strip():
print(">>> error in html file") print(">>> error in html file")
print(f"actual: <{actual}>\nexpected: <{expected}>") print(f"actual: <{actual}>\nexpected: <{expected}>")
sys.exit(1) sys.exit(1)

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/assert-base64"},"response":{"version":"HTTP/1.0","status":200,"body":{"encoding":"base64","value":"bGluZTEKbGluZTIKbGluZTMK"}}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-bytearray"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"bytes"},"predicate":{"type":"equal","value":"AA==","encoding":"base64"}},{"query":{"type":"sha256"},"predicate":{"type":"equal","value":"qBAK5qoZQNC2Y7sxzUZhQuu9vVGHExuS2TgYmHgy64g=","encoding":"base64"}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error/content-encoding"},"response":{"version":"HTTP/1.0","status":200,"body":{"type":"raw-string","value":"Hello World!"}}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-decompress"},"response":{"version":"HTTP/1.0","status":200,"body":{"type":"raw-string","value":"Hello World!"}}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-file"},"response":{"version":"HTTP/1.0","status":200,"body":{"type":"file","filename":"data.txt"}}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-header-not-found"},"response":{"version":"HTTP/1.0","status":200,"headers":[{"name":"Custom","value":"???"}]}}]}

View File

@ -4,4 +4,5 @@
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span> </span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/error-assert-header-value</span></span> <span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/error-assert-header-value</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span> </span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span>
<span class="line"><span class="string">Content-Type</span><span>:</span> <span class="string">???</span></span></span></span></code></pre> <span class="line"><span class="string">Content-Type</span><span>:</span> <span class="string">???</span></span>
</span></span></code></pre>

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-header-value"},"response":{"version":"HTTP/1.0","status":200,"headers":[{"name":"Content-Type","value":"???"}]}},{"request":{"method":"GET","url":"http://localhost:8000/error-assert-header-value"},"response":{"version":"HTTP/1.0","status":200,"headers":[{"name":"Content-Type","value":"???"}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert/http-version"},"response":{"version":"HTTP/2","status":200}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-invalid-predicate-type"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"header","name":"content-type"},"predicate":{"type":"equal","value":1}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert/match-utf8"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"body"},"predicate":{"type":"match","value":".*"}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-newline"},"response":{"version":"HTTP/1.0","status":200,"body":{"type":"raw-string","value":"<p>Hello</p>\n"}}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-query-cookie"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"cookie","expr":"cookie1[Secure]"},"predicate":{"not":true,"type":"exist"}},{"query":{"type":"cookie","expr":"cookie1[Secure]"},"predicate":{"type":"equal","value":false}},{"query":{"type":"cookie","expr":"cookie1[Secure]"},"predicate":{"not":true,"type":"equal","value":true}},{"query":{"type":"cookie","expr":"cookie2[Secure]"},"predicate":{"type":"exist"}},{"query":{"type":"cookie","expr":"cookie2[Secure]"},"predicate":{"type":"equal","value":true}},{"query":{"type":"cookie","expr":"cookie2[Secure]"},"predicate":{"not":true,"type":"equal","value":true}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-query-invalid-regex"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"regex","expr":"[x"},"predicate":{"type":"exist"}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/utf8"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"xpath","expr":"//"},"predicate":{"type":"equal","value":1}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/not_found"},"response":{"version":"HTTP/1.0","status":200}}]}

View File

@ -8,4 +8,5 @@
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.values"</span> <span class="not">not</span> <span class="predicate-type">contains</span> <span class="string">"Hello"</span></span> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.values"</span> <span class="not">not</span> <span class="predicate-type">contains</span> <span class="string">"Hello"</span></span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.count"</span> <span class="predicate-type">greaterThan</span> <span class="number">5</span></span> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.count"</span> <span class="predicate-type">greaterThan</span> <span class="number">5</span></span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.count"</span> <span class="predicate-type">isFloat</span></span> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.count"</span> <span class="predicate-type">isFloat</span></span>
<span class="line"><span class="query-type">bytes</span> <span class="predicate-type">contains</span> hex,<span class="hex">00</span>;</span></span></span></code></pre> <span class="line"><span class="query-type">bytes</span> <span class="predicate-type">contains</span> hex,<span class="hex">00</span>;</span>
</span></span></code></pre>

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-value"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"header","name":"content-type"},"predicate":{"type":"equal","value":"XXX"}},{"query":{"type":"header","name":"content-type"},"predicate":{"type":"not-equal","value":"text/html; charset=utf-8"}},{"query":{"type":"jsonpath","expr":"$.id"},"predicate":{"type":"equal","value":"000001"}},{"query":{"type":"jsonpath","expr":"$.values"},"predicate":{"type":"include","value":100}},{"query":{"type":"jsonpath","expr":"$.values"},"predicate":{"not":true,"type":"contain","value":"Hello"}},{"query":{"type":"jsonpath","expr":"$.count"},"predicate":{"type":"greater","value":5}},{"query":{"type":"jsonpath","expr":"$.count"},"predicate":{"type":"isFloat"}},{"query":{"type":"bytes"},"predicate":{"type":"contain","value":"AA==","encoding":"base64"}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-variable"},"response":{"version":"HTTP/1.0","status":200,"captures":[{"name":"status","query":{"type":"status"}},{"name":"length","query":{"type":"header","name":"content-length"}},{"name":"type","query":{"type":"header","name":"content-type"}}],"asserts":[{"query":{"type":"variable","name":"toto"},"predicate":{"type":"equal","value":"tata"}},{"query":{"type":"variable","name":"status"},"predicate":{"type":"equal","value":"unknown"}},{"query":{"type":"variable","name":"status"},"predicate":{"type":"equal","value":"type"}},{"query":{"type":"variable","name":"status"},"predicate":{"type":"equal","value":"length"}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert-xpath"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"xpath","expr":"strong(//head/title)"},"predicate":{"type":"equal","value":"Welcome to Quiz!"}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"POST","url":"https://unused","body":{"type":"json","value":{"success":"{{success}}"}}}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://10.0.0.0"}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"POST","url":"http://localhost:8000/error-file-read-access","body":{"type":"file","filename":"does_not_exist"}},"response":{"version":"HTTP/1.1","status":200}}]}

View File

@ -18,4 +18,5 @@
<span class="line section-header">[MultipartFormData]</span> <span class="line section-header">[MultipartFormData]</span>
<span class="line"><span class="string"><span class="string">file1</span></span>: file,<span class="string"><span class="filename">../secret.txt</span></span>;</span> <span class="line"><span class="string"><span class="string">file1</span></span>: file,<span class="string"><span class="filename">../secret.txt</span></span>;</span>
</span><span class="response"><span class="line"></span> </span><span class="response"><span class="line"></span>
<span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span></span></span></code></pre> <span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span>
</span></span></code></pre>

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"POST","url":"http://localhost:8000/post-file","body":{"type":"file","filename":"/secret.txt"}},"response":{"version":"HTTP/1.0","status":200}},{"request":{"method":"POST","url":"http://localhost:8000/post-file","body":{"type":"file","filename":"../secret.txt"}},"response":{"version":"HTTP/1.0","status":200}},{"request":{"method":"POST","url":"http://localhost:8000/post-file","multipart_form_data":[{"name":"file1","filename":"/secret.txt"}]},"response":{"version":"HTTP/1.0","status":200}},{"request":{"method":"POST","url":"http://localhost:8000/post-file","multipart_form_data":[{"name":"file1","filename":"../secret.txt"}]},"response":{"version":"HTTP/1.0","status":200}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://unknown"}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-invalid-jsonpath"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"jsonpath","expr":""},"predicate":{"type":"equal","value":false}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"https://???"}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-invalid-xml"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"xpath","expr":"xx"},"predicate":{"type":"equal","value":1}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/redirect/7"},"response":{"version":"HTTP/1.0","status":200}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"POST","url":"http://localhost:8000/unused","multipart_form_data":[{"name":"key1","value":"value1"},{"name":"upload1","filename":"unknown"}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/redirect/7"},"response":{"version":"HTTP/1.0","status":200}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/not-found"},"response":{"status":200}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-output-decompress"},"response":{"version":"HTTP/1.0","status":200}}]}

View File

@ -14,4 +14,5 @@
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.message"</span> <span class="subquery-type">count</span> <span class="predicate-type">==</span> <span class="number">1</span></span> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.message"</span> <span class="subquery-type">count</span> <span class="predicate-type">==</span> <span class="number">1</span></span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.toto"</span> <span class="predicate-type">exists</span></span> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.toto"</span> <span class="predicate-type">exists</span></span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.message"</span> <span class="not">not</span> <span class="predicate-type">exists</span></span> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.message"</span> <span class="not">not</span> <span class="predicate-type">exists</span></span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.list"</span> <span class="subquery-type">count</span> <span class="predicate-type">==</span> <span class="number">2</span></span></span></span></code></pre> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.list"</span> <span class="subquery-type">count</span> <span class="predicate-type">==</span> <span class="number">2</span></span>
</span></span></code></pre>

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/predicate/error/type"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"jsonpath","expr":"$.status"},"predicate":{"type":"equal","value":"true"}},{"query":{"type":"jsonpath","expr":"$.count"},"predicate":{"type":"equal","value":0}},{"query":{"type":"jsonpath","expr":"$.message"},"predicate":{"type":"equal","value":0}},{"query":{"type":"jsonpath","expr":"$.empty"},"predicate":{"type":"equal","value":0}},{"query":{"type":"jsonpath","expr":"$.number"},"predicate":{"type":"equal","value":1.1}},{"query":{"type":"jsonpath","expr":"$.message"},"predicate":{"type":"start-with","value":"hi"}},{"query":{"type":"jsonpath","expr":"$.message"},"predicate":{"type":"end-with","value":"hi"}},{"query":{"type":"jsonpath","expr":"$.message"},"predicate":{"type":"contain","value":"hi"}},{"query":{"type":"jsonpath","expr":"$.message"},"predicate":{"type":"match","value":"hi"}},{"query":{"type":"jsonpath","expr":"$.message","subquery":{"type":"count"}},"predicate":{"type":"equal","value":1}},{"query":{"type":"jsonpath","expr":"$.toto"},"predicate":{"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.message"},"predicate":{"not":true,"type":"exist"}},{"query":{"type":"jsonpath","expr":"$.list","subquery":{"type":"count"}},"predicate":{"type":"equal","value":2}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-query-header-not-found"},"response":{"version":"HTTP/1.0","status":200,"headers":[{"name":"Custom","value":"XXX"}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-query-invalid-json"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"jsonpath","expr":"$.errors","subquery":{"type":"count"}},"predicate":{"type":"equal","value":2}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-query-invalid-utf8"},"response":{"version":"HTTP/1.0","status":200,"asserts":[{"query":{"type":"jsonpath","expr":"$.errors","subquery":{"type":"count"}},"predicate":{"type":"equal","value":2}}]}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/query-match-none"},"response":{"asserts":[{"query":{"type":"header","name":"Location"},"predicate":{"type":"match","value":"^foo$","encoding":"regex"}}]}}]}

View File

@ -1,2 +1,3 @@
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/not-found</span></span> <pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/not-found</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/*</span> <span class="number">200</span></span></span></span></code></pre> </span><span class="response"><span class="line"><span class="version">HTTP/*</span> <span class="number">200</span></span>
</span></span></code></pre>

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/not-found"},"response":{"status":200}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"{{url}}"}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/get-list"},"response":{"version":"HTTP/1.0","status":200,"captures":[{"name":"list","query":{"type":"jsonpath","expr":"$.values"}}]}},{"request":{"method":"GET","url":"http://localhost:8000/undefined","query_string_params":[{"name":"param1","value":"{{list}}"}]},"response":{"version":"HTTP/1.1","status":200}}]}

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/timeout"}}]}

View File

@ -11,4 +11,5 @@
<span class="line"><span class="query-type">header</span> <span class="string">"Set-Cookie"</span> <span class="predicate-type">exists</span></span> <span class="line"><span class="query-type">header</span> <span class="string">"Set-Cookie"</span> <span class="predicate-type">exists</span></span>
<span class="line"><span class="query-type">header</span> <span class="string">"Set-Cookie"</span> <span class="subquery-type">count</span> <span class="predicate-type">==</span> <span class="number">3</span></span> <span class="line"><span class="query-type">header</span> <span class="string">"Set-Cookie"</span> <span class="subquery-type">count</span> <span class="predicate-type">==</span> <span class="number">3</span></span>
<span class="line"><span class="query-type">header</span> <span class="string">"Set-Cookie"</span> <span class="predicate-type">includes</span> <span class="string">"cookie1=value1; Path=/"</span></span> <span class="line"><span class="query-type">header</span> <span class="string">"Set-Cookie"</span> <span class="predicate-type">includes</span> <span class="string">"cookie1=value1; Path=/"</span></span>
<span class="line"><span class="query-type">header</span> <span class="string">"Set-Cookie"</span> <span class="not">not</span> <span class="predicate-type">includes</span> <span class="string">"cookie4=value4; Path=/"</span></span></span></span></code></pre> <span class="line"><span class="query-type">header</span> <span class="string">"Set-Cookie"</span> <span class="not">not</span> <span class="predicate-type">includes</span> <span class="string">"cookie4=value4; Path=/"</span></span>
</span></span></code></pre>

View File

@ -89,4 +89,5 @@
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/assert-json/filter</span></span> <span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/assert-json/filter</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span> </span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span>
<span class="line section-header">[Asserts]</span> <span class="line section-header">[Asserts]</span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.fruit[?(@.price.US==200)].name"</span> <span class="predicate-type">equals</span> <span class="string">"grape"</span></span></span></span></code></pre> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.fruit[?(@.price.US==200)].name"</span> <span class="predicate-type">equals</span> <span class="string">"grape"</span></span>
</span></span></code></pre>

View File

@ -7,4 +7,5 @@
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.date1"</span> <span class="predicate-type">matches</span> <span class="regex">/^\d{4}-\d{2}-\d{2}$/</span></span> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.date1"</span> <span class="predicate-type">matches</span> <span class="regex">/^\d{4}-\d{2}-\d{2}$/</span></span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.date2"</span> <span class="not">not</span> <span class="predicate-type">matches</span> <span class="regex">/^\d{4}-\d{2}-\d{2}$/</span></span> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.date2"</span> <span class="not">not</span> <span class="predicate-type">matches</span> <span class="regex">/^\d{4}-\d{2}-\d{2}$/</span></span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.path1"</span> <span class="predicate-type">matches</span> <span class="regex">/aa\/bb/</span></span> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.path1"</span> <span class="predicate-type">matches</span> <span class="regex">/aa\/bb/</span></span>
<span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.path2"</span> <span class="predicate-type">matches</span> <span class="regex">/aa\\bb/</span></span></span></span></code></pre> <span class="line"><span class="query-type">jsonpath</span> <span class="string">"$.path2"</span> <span class="predicate-type">matches</span> <span class="regex">/aa\\bb/</span></span>
</span></span></code></pre>

View File

@ -5,4 +5,5 @@
<span class="line"><span class="query-type">regex</span> <span class="string">"Hello ([0-9]+)!"</span> <span class="not">not</span> <span class="predicate-type">exists</span></span> <span class="line"><span class="query-type">regex</span> <span class="string">"Hello ([0-9]+)!"</span> <span class="not">not</span> <span class="predicate-type">exists</span></span>
<span class="line"><span class="query-type">regex</span> <span class="regex">/Hello ([0-9]+)!/</span> <span class="not">not</span> <span class="predicate-type">exists</span></span> <span class="line"><span class="query-type">regex</span> <span class="regex">/Hello ([0-9]+)!/</span> <span class="not">not</span> <span class="predicate-type">exists</span></span>
<span class="line"><span class="query-type">regex</span> <span class="string">"Hello ([a-zA-Z]+)!"</span> <span class="predicate-type">==</span> <span class="string">"World"</span></span> <span class="line"><span class="query-type">regex</span> <span class="string">"Hello ([a-zA-Z]+)!"</span> <span class="predicate-type">==</span> <span class="string">"World"</span></span>
<span class="line"><span class="query-type">regex</span> <span class="regex">/Hello ([a-zA-Z]+)!/</span> <span class="predicate-type">==</span> <span class="string">"World"</span></span></span></span></code></pre> <span class="line"><span class="query-type">regex</span> <span class="regex">/Hello ([a-zA-Z]+)!/</span> <span class="predicate-type">==</span> <span class="string">"World"</span></span>
</span></span></code></pre>

View File

@ -14,4 +14,5 @@
</span><span class="response"><span class="line"><span class="version">HTTP/*</span> <span class="number">*</span></span> </span><span class="response"><span class="line"><span class="version">HTTP/*</span> <span class="number">*</span></span>
<span class="line section-header">[Asserts]</span> <span class="line section-header">[Asserts]</span>
<span class="line"><span class="query-type">status</span> <span class="predicate-type">&gt;=</span> <span class="number">200</span></span> <span class="line"><span class="query-type">status</span> <span class="predicate-type">&gt;=</span> <span class="number">200</span></span>
<span class="line"><span class="query-type">status</span> <span class="predicate-type">&lt;</span> <span class="number">300</span></span></span></span></code></pre> <span class="line"><span class="query-type">status</span> <span class="predicate-type">&lt;</span> <span class="number">300</span></span>
</span></span></code></pre>

View File

@ -0,0 +1,11 @@
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/charset/default</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span>
<span class="line"><span class="string">Content-Type</span><span>:</span> <span class="string">text/html; charset=utf-8</span></span>
<span class="raw"><span class="line">```&lt;p&gt;Hello World!&lt;/p&gt;```</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"></span>
<span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/charset/uppercase</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span>
<span class="line"><span class="string">Content-Type</span><span>:</span> <span class="string">text/html; charset=UTF-8</span></span>
<span class="line section-header">[Asserts]</span>
<span class="line"><span class="query-type">body</span> <span class="predicate-type">==</span> <span class="string">"&lt;p&gt;Hello World!&lt;/p&gt;"</span></span>
</span></span></code></pre>

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/charset/default"},"response":{"version":"HTTP/1.0","status":200,"headers":[{"name":"Content-Type","value":"text/html; charset=utf-8"}],"body":{"type":"raw-string","value":"<p>Hello World!</p>"}}},{"request":{"method":"GET","url":"http://localhost:8000/charset/uppercase"},"response":{"version":"HTTP/1.0","status":200,"headers":[{"name":"Content-Type","value":"text/html; charset=UTF-8"}],"asserts":[{"query":{"type":"body"},"predicate":{"type":"equal","value":"<p>Hello World!</p>"}}]}}]}

View File

@ -1 +1,3 @@
<pre><code class="language-hurl"></code></pre> <pre><code class="language-hurl"><span class="line"></span>
<span class="line"></span>
</code></pre>

View File

@ -0,0 +1,2 @@

View File

@ -1 +1,3 @@
<pre><code class="language-hurl"></code></pre> <pre><code class="language-hurl"><span class="line"></span>
<span class="line"></span>
</code></pre>

View File

@ -0,0 +1,2 @@

View File

@ -1,3 +1,5 @@
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/follow-redirect</span></span> <pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/follow-redirect</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span> </span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span>
<span class="raw"><span class="line">```Followed redirect!```</span></span></span></span></code></pre> <span class="raw"><span class="line">```Followed redirect!```</span></span>
</span></span><span class="line"></span>
</code></pre>

View File

@ -1,3 +1,4 @@
GET http://localhost:8000/follow-redirect GET http://localhost:8000/follow-redirect
HTTP/1.0 200 HTTP/1.0 200
```Followed redirect!``` ```Followed redirect!```

View File

@ -4,4 +4,5 @@
<span class="line"><span class="string">insecure</span><span>:</span> <span class="boolean">false</span></span> <span class="line"><span class="string">insecure</span><span>:</span> <span class="boolean">false</span></span>
</span><span class="response"><span class="line"></span> </span><span class="response"><span class="line"></span>
<span class="line"><span class="version">HTTP/*</span> <span class="number">200</span></span> <span class="line"><span class="version">HTTP/*</span> <span class="number">200</span></span>
<span class="raw"><span class="line">```Hello World!```</span></span></span></span></code></pre> <span class="raw"><span class="line">```Hello World!```</span></span>
</span></span></code></pre>

View File

@ -0,0 +1,3 @@
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/hello</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span>
<span class="raw"><span class="line">```Hello World!```</span></span></span></span></code></pre>

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"version":"HTTP/1.0","status":200,"body":{"type":"raw-string","value":"Hello World!"}}}]}

View File

@ -0,0 +1,3 @@
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/hello</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span>
<span class="raw"><span class="line">```Hello World!```</span></span></span></span></code></pre>

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"version":"HTTP/1.0","status":200,"body":{"type":"raw-string","value":"Hello World!"}}}]}

View File

@ -0,0 +1,3 @@
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/hello</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span>
<span class="raw"><span class="line">```Hello World!```</span></span></span></span></code></pre>

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/hello"},"response":{"version":"HTTP/1.0","status":200,"body":{"type":"raw-string","value":"Hello World!"}}}]}

View File

@ -1,3 +1,4 @@
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/hello</span></span> <pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/hello</span></span>
</span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span> </span><span class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="number">200</span></span>
<span class="raw"><span class="line">```Hello World!```</span></span></span></span></code></pre> <span class="raw"><span class="line">```Hello World!```</span></span>
</span></span></code></pre>

View File

@ -32,4 +32,5 @@
<span class="line"><span class="query-type">variable</span> <span class="string">"height"</span> <span class="predicate-type">==</span> <span class="number">1.70</span></span> <span class="line"><span class="query-type">variable</span> <span class="string">"height"</span> <span class="predicate-type">==</span> <span class="number">1.70</span></span>
<span class="line"><span class="query-type">variable</span> <span class="string">"a_null"</span> <span class="predicate-type">==</span> <span class="null">null</span></span> <span class="line"><span class="query-type">variable</span> <span class="string">"a_null"</span> <span class="predicate-type">==</span> <span class="null">null</span></span>
<span class="line"><span class="query-type">variable</span> <span class="string">"my-id"</span> <span class="predicate-type">==</span> <span class="string">"123"</span></span> <span class="line"><span class="query-type">variable</span> <span class="string">"my-id"</span> <span class="predicate-type">==</span> <span class="string">"123"</span></span>
<span class="line"><span class="query-type">variable</span> <span class="string">"country"</span> <span class="predicate-type">==</span> <span class="string">"Italy"</span></span></span></span></code></pre> <span class="line"><span class="query-type">variable</span> <span class="string">"country"</span> <span class="predicate-type">==</span> <span class="string">"Italy"</span></span>
</span></span></code></pre>

View File

@ -0,0 +1,3 @@
<pre><code class="language-hurl"><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/verbose</span></span>
</span></span><span class="line"></span>
</code></pre>

View File

@ -1 +1,2 @@
GET http://localhost:8000/verbose GET http://localhost:8000/verbose

View File

@ -0,0 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/verbose"}}]}

View File

@ -238,6 +238,11 @@ fn main() {
process::exit(1); process::exit(1);
} }
}; };
let output = if output.ends_with('\n') {
output
} else {
format!("{}\n", output)
};
write_output(output.into_bytes(), output_file.as_deref()); write_output(output.into_bytes(), output_file.as_deref());
} }
} }