mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-26 00:22:10 +03:00
Newline added at the end of the files
hurlfmt now also outputs a trailing newline.
This commit is contained in:
parent
1419e706fd
commit
bf79a512e0
@ -25,7 +25,7 @@ def test(format_type, hurl_file):
|
||||
cmd = ["hurlfmt", "--format", format_type, hurl_file]
|
||||
print(" ".join(cmd))
|
||||
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)
|
||||
if actual != expected:
|
||||
print(f">>> error in stdout for {format_type}")
|
||||
|
@ -16,7 +16,7 @@ def test(html_file):
|
||||
expected = codecs.open(
|
||||
hurl_file, encoding="utf-8-sig"
|
||||
).read() # Input file can be saved with a BOM
|
||||
if actual != expected:
|
||||
if actual.strip() != expected.strip():
|
||||
print(">>> error in html file")
|
||||
print(f"actual: <{actual}>\nexpected: <{expected}>")
|
||||
sys.exit(1)
|
||||
|
1
integration/tests_failed/assert_base64.json
Normal file
1
integration/tests_failed/assert_base64.json
Normal 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"}}}]}
|
1
integration/tests_failed/assert_bytearray.json
Normal file
1
integration/tests_failed/assert_bytearray.json
Normal 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"}}]}}]}
|
1
integration/tests_failed/assert_content_encoding.json
Normal file
1
integration/tests_failed/assert_content_encoding.json
Normal 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!"}}}]}
|
1
integration/tests_failed/assert_decompress.json
Normal file
1
integration/tests_failed/assert_decompress.json
Normal 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!"}}}]}
|
1
integration/tests_failed/assert_file.json
Normal file
1
integration/tests_failed/assert_file.json
Normal 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"}}}]}
|
1
integration/tests_failed/assert_header_not_found.json
Normal file
1
integration/tests_failed/assert_header_not_found.json
Normal 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":"???"}]}}]}
|
@ -4,4 +4,5 @@
|
||||
</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><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>
|
||||
|
1
integration/tests_failed/assert_header_value.json
Normal file
1
integration/tests_failed/assert_header_value.json
Normal 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":"???"}]}}]}
|
1
integration/tests_failed/assert_http_version.json
Normal file
1
integration/tests_failed/assert_http_version.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-assert/http-version"},"response":{"version":"HTTP/2","status":200}}]}
|
@ -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}}]}}]}
|
1
integration/tests_failed/assert_match_utf8.json
Normal file
1
integration/tests_failed/assert_match_utf8.json
Normal 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":".*"}}]}}]}
|
1
integration/tests_failed/assert_newline.json
Normal file
1
integration/tests_failed/assert_newline.json
Normal 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"}}}]}
|
1
integration/tests_failed/assert_query_cookie.json
Normal file
1
integration/tests_failed/assert_query_cookie.json
Normal 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}}]}}]}
|
1
integration/tests_failed/assert_query_invalid_regex.json
Normal file
1
integration/tests_failed/assert_query_invalid_regex.json
Normal 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"}}]}}]}
|
1
integration/tests_failed/assert_query_invalid_xpath.json
Normal file
1
integration/tests_failed/assert_query_invalid_xpath.json
Normal 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}}]}}]}
|
1
integration/tests_failed/assert_status.json
Normal file
1
integration/tests_failed/assert_status.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/not_found"},"response":{"version":"HTTP/1.0","status":200}}]}
|
@ -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">"$.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">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>
|
||||
|
1
integration/tests_failed/assert_value_error.json
Normal file
1
integration/tests_failed/assert_value_error.json
Normal 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"}}]}}]}
|
1
integration/tests_failed/assert_variable.json
Normal file
1
integration/tests_failed/assert_variable.json
Normal 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"}}]}}]}
|
1
integration/tests_failed/assert_xpath.json
Normal file
1
integration/tests_failed/assert_xpath.json
Normal 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!"}}]}}]}
|
1
integration/tests_failed/body_json.json
Normal file
1
integration/tests_failed/body_json.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"POST","url":"https://unused","body":{"type":"json","value":{"success":"{{success}}"}}}}]}
|
1
integration/tests_failed/connect_timeout.json
Normal file
1
integration/tests_failed/connect_timeout.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://10.0.0.0"}}]}
|
1
integration/tests_failed/file_read_access.json
Normal file
1
integration/tests_failed/file_read_access.json
Normal 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}}]}
|
@ -18,4 +18,5 @@
|
||||
<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><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>
|
||||
|
1
integration/tests_failed/file_unauthorized.json
Normal file
1
integration/tests_failed/file_unauthorized.json
Normal 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}}]}
|
1
integration/tests_failed/http_connection.json
Normal file
1
integration/tests_failed/http_connection.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://unknown"}}]}
|
1
integration/tests_failed/invalid_jsonpath.json
Normal file
1
integration/tests_failed/invalid_jsonpath.json
Normal 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}}]}}]}
|
1
integration/tests_failed/invalid_url.json
Normal file
1
integration/tests_failed/invalid_url.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"https://???"}}]}
|
1
integration/tests_failed/invalid_xml.json
Normal file
1
integration/tests_failed/invalid_xml.json
Normal 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}}]}}]}
|
1
integration/tests_failed/max_redirect.json
Normal file
1
integration/tests_failed/max_redirect.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/redirect/7"},"response":{"version":"HTTP/1.0","status":200}}]}
|
1
integration/tests_failed/multipart_form_data.json
Normal file
1
integration/tests_failed/multipart_form_data.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"POST","url":"http://localhost:8000/unused","multipart_form_data":[{"name":"key1","value":"value1"},{"name":"upload1","filename":"unknown"}]}}]}
|
1
integration/tests_failed/option_max_redirect.json
Normal file
1
integration/tests_failed/option_max_redirect.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/redirect/7"},"response":{"version":"HTTP/1.0","status":200}}]}
|
1
integration/tests_failed/option_retry.json
Normal file
1
integration/tests_failed/option_retry.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/not-found"},"response":{"status":200}}]}
|
1
integration/tests_failed/output_decompress.json
Normal file
1
integration/tests_failed/output_decompress.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/error-output-decompress"},"response":{"version":"HTTP/1.0","status":200}}]}
|
@ -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">"$.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">"$.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>
|
||||
|
1
integration/tests_failed/predicate.json
Normal file
1
integration/tests_failed/predicate.json
Normal 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}}]}}]}
|
1
integration/tests_failed/query_header_not_found.json
Normal file
1
integration/tests_failed/query_header_not_found.json
Normal 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"}]}}]}
|
1
integration/tests_failed/query_invalid_json.json
Normal file
1
integration/tests_failed/query_invalid_json.json
Normal 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}}]}}]}
|
1
integration/tests_failed/query_invalid_utf8.json
Normal file
1
integration/tests_failed/query_invalid_utf8.json
Normal 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}}]}}]}
|
1
integration/tests_failed/query_match_none.json
Normal file
1
integration/tests_failed/query_match_none.json
Normal 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"}}]}}]}
|
@ -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>
|
||||
</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>
|
||||
|
1
integration/tests_failed/retry.json
Normal file
1
integration/tests_failed/retry.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/not-found"},"response":{"status":200}}]}
|
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"{{url}}"}}]}
|
@ -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}}]}
|
1
integration/tests_failed/timeout.json
Normal file
1
integration/tests_failed/timeout.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/timeout"}}]}
|
@ -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="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="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>
|
||||
|
@ -89,4 +89,5 @@
|
||||
<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 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>
|
||||
|
@ -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">"$.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">"$.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>
|
||||
|
@ -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="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="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>
|
||||
|
@ -14,4 +14,5 @@
|
||||
</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"><span class="query-type">status</span> <span class="predicate-type">>=</span> <span class="number">200</span></span>
|
||||
<span class="line"><span class="query-type">status</span> <span class="predicate-type"><</span> <span class="number">300</span></span></span></span></code></pre>
|
||||
<span class="line"><span class="query-type">status</span> <span class="predicate-type"><</span> <span class="number">300</span></span>
|
||||
</span></span></code></pre>
|
||||
|
11
integration/tests_ok/charset.html
Normal file
11
integration/tests_ok/charset.html
Normal 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">```<p>Hello World!</p>```</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">"<p>Hello World!</p>"</span></span>
|
||||
</span></span></code></pre>
|
1
integration/tests_ok/charset.json
Normal file
1
integration/tests_ok/charset.json
Normal 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>"}}]}}]}
|
@ -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>
|
||||
|
@ -0,0 +1,2 @@
|
||||
|
||||
|
@ -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>
|
||||
|
@ -0,0 +1,2 @@
|
||||
|
||||
|
@ -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>
|
||||
</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>
|
||||
|
@ -1,3 +1,4 @@
|
||||
GET http://localhost:8000/follow-redirect
|
||||
HTTP/1.0 200
|
||||
```Followed redirect!```
|
||||
|
||||
|
@ -4,4 +4,5 @@
|
||||
<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 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>
|
||||
|
3
integration/tests_ok/test.1.html
Normal file
3
integration/tests_ok/test.1.html
Normal 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>
|
1
integration/tests_ok/test.1.json
Normal file
1
integration/tests_ok/test.1.json
Normal 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!"}}}]}
|
3
integration/tests_ok/test.2.html
Normal file
3
integration/tests_ok/test.2.html
Normal 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>
|
1
integration/tests_ok/test.2.json
Normal file
1
integration/tests_ok/test.2.json
Normal 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!"}}}]}
|
3
integration/tests_ok/test.3.html
Normal file
3
integration/tests_ok/test.3.html
Normal 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>
|
1
integration/tests_ok/test.3.json
Normal file
1
integration/tests_ok/test.3.json
Normal 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!"}}}]}
|
@ -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>
|
||||
</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>
|
||||
|
@ -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">"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">"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>
|
||||
|
3
integration/tests_ok/verbose.html
Normal file
3
integration/tests_ok/verbose.html
Normal 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>
|
@ -1 +1,2 @@
|
||||
GET http://localhost:8000/verbose
|
||||
|
||||
|
1
integration/tests_ok/verbose.json
Normal file
1
integration/tests_ok/verbose.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/verbose"}}]}
|
@ -238,6 +238,11 @@ fn main() {
|
||||
process::exit(1);
|
||||
}
|
||||
};
|
||||
let output = if output.ends_with('\n') {
|
||||
output
|
||||
} else {
|
||||
format!("{}\n", output)
|
||||
};
|
||||
write_output(output.into_bytes(), output_file.as_deref());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user