# Presentation differences that are not identity differences.
get_url_key(c("http://example.com:80/a", "http://example.com/a"))
# The fragment and userinfo are excluded from web-resource identity.
k <- get_url_key(c("http://u:[email protected]/a#top", "http://example.com/a"))
k[1] == k[2]
# Query order and duplicates are significant.
k <- get_url_key(c("http://example.com/?a=1&b=2",
"http://example.com/?b=2&a=1"))
k[1] == k[2]
# Deduplicate by identity rather than by string.
u <- c("HTTP://Example.com/a", "http://example.com/a",
"http://example.com/b")
u[!duplicated(get_url_key(u))]
# Non-keyable input carries a typed reason.
k <- get_url_key(c("http://example.com/", NA, "", ":::"))
attr(k, "keyability")
Run the code above in your browser using DataLab