Skip to content

Commit

Permalink
Remove url-specific parser (align with grammar)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricereix committed Nov 3, 2024
1 parent 2a182f1 commit 79ea724
Show file tree
Hide file tree
Showing 21 changed files with 25 additions and 386 deletions.
1 change: 0 additions & 1 deletion integration/hurl/tests_error_parser/invalid_url.hurl

This file was deleted.

3 changes: 0 additions & 3 deletions integration/hurl/tests_error_parser/invalid_url.sh

This file was deleted.

3 changes: 0 additions & 3 deletions integration/hurl/tests_error_parser/invalid_url_1.sh

This file was deleted.

3 changes: 0 additions & 3 deletions integration/hurl/tests_error_parser/invalid_url_2.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: Parsing URL
--> tests_error_parser/parallel_parsing_error_c.hurl:4:5
error: Parsing space
--> tests_error_parser/parallel_parsing_error_c.hurl:4:4
 |
 4 | GET //localhost:8000/hello
 | ^ expecting http://, https:// or {{
 4 | GET//localhost:8000/hello
 | ^ expecting a space
 |

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GET http://localhost:8000/hello
HTTP 200

GET //localhost:8000/hello
GET//localhost:8000/hello
HTTP 200

GET http://localhost:8000/hello
Expand Down
7 changes: 0 additions & 7 deletions integration/hurl/tests_error_parser/url_bad_prefix.err

This file was deleted.

1 change: 0 additions & 1 deletion integration/hurl/tests_error_parser/url_bad_prefix.exit

This file was deleted.

4 changes: 0 additions & 4 deletions integration/hurl/tests_error_parser/url_bad_prefix.hurl

This file was deleted.

3 changes: 0 additions & 3 deletions integration/hurl/tests_error_parser/url_bad_prefix.ps1

This file was deleted.

3 changes: 0 additions & 3 deletions integration/hurl/tests_error_parser/url_bad_prefix.sh

This file was deleted.

10 changes: 5 additions & 5 deletions integration/hurl/tests_ok/querystring_params.curl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
curl 'http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3Db&param4=1%2C2%2C3&$top=5'
curl 'http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3Db&param4=1%2C2%2C3&$top=5'
curl 'http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3db&param4=1,2,3&$top=5'
curl 'http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3Db&param4=1%2C2%2C3&$top=5'
curl 'http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3Db&param4=1%2C2%2C3&$top=5'
curl 'http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3Db&param4=1%2C2%2C3&param5=\{bar\}&$top=5'
curl 'http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3Db&param4=1%2C2%2C3&param5=\{bar\}&$top=5'
curl 'http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3db&param4=1,2,3&param5=\{bar\}&$top=5'
curl 'http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3Db&param4=1%2C2%2C3&param5=\{bar\}&$top=5'
curl 'http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3Db&param4=1%2C2%2C3&param5=\{bar\}&$top=5'
curl 'http://localhost:8000/querystring-params-encoded?value1=/&value2=%2F&value3=%2F'
curl 'http://localhost:8000/querystring-params-encoded?value1=/&value2=%2F&value3=%2F'
7 changes: 5 additions & 2 deletions integration/hurl/tests_ok/querystring_params.hurl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ param1: value1
param2:
param3: a=b
param4: 1,2,3
param5: {bar}
$top: 5
HTTP 200

Expand All @@ -14,12 +15,13 @@ param1: value1
param2:
param3: a=b
param4: 1,2,3
param5: {bar}
$top: 5
HTTP 200


# Same version as raw
GET http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3db&param4=1,2,3&$top=5
GET http://localhost:8000/querystring-params?param1=value1&param2=&param3=a%3db&param4=1,2,3&param5={bar}&$top=5
HTTP 200


Expand All @@ -29,11 +31,12 @@ GET http://localhost:8000/querystring-params?param1=value1
param2:
param3: a=b
param4: 1,2,3
param5: {bar}
$top: 5
HTTP 200


GET http://localhost:8000/querystring-params?param1=value1
GET http://localhost:8000/querystring-params?param1=value1&param5={bar}
[Query]
param2:
param3: a=b
Expand Down
1 change: 1 addition & 0 deletions integration/hurl/tests_ok/querystring_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def querystring_params():
assert request.args.get("param2") == ""
assert request.args.get("param3") == "a=b"
assert request.args.get("param4") == "1,2,3"
assert request.args.get("param5") == "{bar}"
assert request.args.get("$top") == "5"
return ""

Expand Down
5 changes: 2 additions & 3 deletions integration/hurlfmt/tests_export/url.html
Original file line number Diff line number Diff line change
@@ -1,6 +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/~user</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/%7Euser</span></span>
</span></span><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000/!$&amp;()*+,;=:@[]</span></span>
</span></span><span class="line"></span>
<span class="line"></span>
</code></pre>
</span></span><span class="hurl-entry"><span class="request"><span class="line"><span class="method">GET</span> <span class="url">http://localhost:8000?foo={bar}</span></span>
</span></span></code></pre>
3 changes: 1 addition & 2 deletions integration/hurlfmt/tests_export/url.hurl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
GET http://localhost:8000/~user
GET http://localhost:8000/%7Euser
GET http://localhost:8000/!$&()*+,;=:@[]


GET http://localhost:8000?foo={bar}
2 changes: 1 addition & 1 deletion integration/hurlfmt/tests_export/url.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/~user"}},{"request":{"method":"GET","url":"http://localhost:8000/%7Euser"}},{"request":{"method":"GET","url":"http://localhost:8000/!$&()*+,;=:@[]"}}]}
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/~user"}},{"request":{"method":"GET","url":"http://localhost:8000/%7Euser"}},{"request":{"method":"GET","url":"http://localhost:8000/!$&()*+,;=:@[]"}},{"request":{"method":"GET","url":"http://localhost:8000?foo={bar}"}}]}
3 changes: 1 addition & 2 deletions integration/hurlfmt/tests_export/url.lint.hurl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
GET http://localhost:8000/~user
GET http://localhost:8000/%7Euser
GET http://localhost:8000/!$&()*+,;=:@[]


GET http://localhost:8000?foo={bar}
1 change: 0 additions & 1 deletion packages/hurl_core/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,4 @@ mod query;
mod sections;
mod string;
mod template;
mod url;
mod xml;
8 changes: 4 additions & 4 deletions packages/hurl_core/src/parser/parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ use crate::parser::error::*;
use crate::parser::number::natural;
use crate::parser::primitives::*;
use crate::parser::sections::*;
use crate::parser::url::url;
use crate::parser::ParseResult;
use crate::reader::Reader;

use super::string::unquoted_template;

pub fn hurl_file(reader: &mut Reader) -> ParseResult<HurlFile> {
let entries = zero_or_more(entry, reader)?;
let line_terminators = optional_line_terminators(reader)?;
Expand All @@ -52,8 +53,7 @@ fn request(reader: &mut Reader) -> ParseResult<Request> {
let space0 = zero_or_more_spaces(reader)?;
let m = method(reader)?;
let space1 = one_or_more_spaces(reader)?;
let u = url(reader)?;

let url = unquoted_template(reader)?;
let line_terminator0 = line_terminator(reader)?;
let headers = zero_or_more(key_value, reader)?;
let sections = request_sections(reader)?;
Expand All @@ -79,7 +79,7 @@ fn request(reader: &mut Reader) -> ParseResult<Request> {
space0,
method: m,
space1,
url: u,
url,
line_terminator0,
headers,
sections,
Expand Down
Loading

0 comments on commit 79ea724

Please sign in to comment.