Skip to content

Commit

Permalink
feat(uri): allow utf8 char, not rfc 3986 compliant, in path and query (
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwurtz authored Dec 20, 2024
1 parent a912445 commit 091ee9a
Showing 1 changed file with 12 additions and 2 deletions.
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

0 comments on commit 091ee9a

Please sign in to comment.