Skip to content

fix(uri): treat empty PathAndQuery as equal to slash - #875

Open
00200200 wants to merge 1 commit into
hyperium:masterfrom
00200200:fix-empty-path-eq
Open

00200200 wants to merge 1 commit into
hyperium:masterfrom
00200200:fix-empty-path-eq

Conversation

@00200200

Copy link
Copy Markdown

Closes #534

Empty PathAndQuery already displays as /, orders as / via PartialOrd, and compares equal to the string "/". PartialEq and Hash compared the raw bytes, so empty and slash were unequal even though partial_cmp returns Equal.

This uses as_str() for equality and hashing so those traits stay consistent with PartialOrd and with Uri equality.

Empty paths already display, order, and compare to "/" as slash.
Use as_str() for PartialEq and Hash so they stay consistent.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PathAndQuery == PathAndQuery doesn't handle empty paths properly

1 participant