-
Notifications
You must be signed in to change notification settings - Fork 475
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
Query parameters are not removed when resolving URLs #113
Comments
Looking at examples in the RFC most of the following tests fail: test("absoluteTo", function() {
// http://tools.ietf.org/html/rfc3986#section-5.4
var uri;
var base = 'http://a/b/c/d;p?q';
var map = {
// normal
// "g:h" : "g:h", // identified as URN
"g" : "http://a/b/c/g",
"./g" : "http://a/b/c/g",
"g/" : "http://a/b/c/g/",
"/g" : "http://a/g",
"//g" : "http://g",
"?y" : "http://a/b/c/d;p?y",
"g?y" : "http://a/b/c/g?y",
"#s" : "http://a/b/c/d;p?q#s",
"g#s" : "http://a/b/c/g#s",
"g?y#s" : "http://a/b/c/g?y#s",
";x" : "http://a/b/c/;x",
"g;x" : "http://a/b/c/g;x",
"g;x?y#s" : "http://a/b/c/g;x?y#s",
"" : "http://a/b/c/d;p?q",
"." : "http://a/b/c/",
"./" : "http://a/b/c/",
".." : "http://a/b/",
"../" : "http://a/b/",
"../g" : "http://a/b/g",
"../.." : "http://a/",
"../../" : "http://a/",
"../../g" : "http://a/g",
// abnormal
"../../../g" : "http://a/g",
"../../../../g" : "http://a/g"
};
for (var key in map) {
uri = URI(key).absoluteTo(base);
equal(r + "", map[key], 'reference resolution ' + key);
}
}); @djcsdy have you got anything to say about query+hash in absoluteTo()? otherwise I'd just remove them… |
I believe the query should stay the same if we are just resolving against a hash. See the "#s" example in your code. |
@rodneyrehm Those tests derived from the spec look pretty complete. The query component of a base URL should be retained if and only if:
Otherwise it should be discarded. |
I agree. I'll look into fixing |
fixed in master, will be included in the next release |
When navigating to "test.html" from "http://example.com/somewhere.html?a=b#c", I expect the URL to be "http://example.com/test.html", not "http://example.com/test.html?a=b". Here's simple node REPL code to replicate it.
The text was updated successfully, but these errors were encountered: