Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(path-and-query): allow utf8 char, not rfc 3986 compliant, in path and query #715

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/uri/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl PathAndQuery {
0x40..=0x5F |
0x61..=0x7A |
0x7C |
0x7E => {}
0x7E..=0xFF => {}

// These are code points that are supposed to be
// percent-encoded in the path but there are clients
Expand Down Expand Up @@ -82,7 +82,7 @@ impl PathAndQuery {
0x21 |
0x24..=0x3B |
0x3D |
0x3F..=0x7E => {}
0x3F..=0xFF => {}

b'#' => {
fragment = Some(i);
Expand Down Expand Up @@ -556,6 +556,16 @@ mod tests {
assert_eq!("qr=%3", pq("/a/b?qr=%3").query().unwrap());
}

#[test]
fn allow_utf8_in_path() {
assert_eq!("/🍕", pq("/🍕").path());
}

#[test]
fn allow_utf8_in_query() {
assert_eq!(Some("pizza=🍕"), pq("/test?pizza=🍕").query());
}

#[test]
fn json_is_fine() {
assert_eq!(
Expand Down
Loading