0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

Default base URL path to '/' (#2921)

This commit is contained in:
Nayeem Rahman 2019-09-11 21:20:54 +01:00 committed by Ryan Dahl
parent f38bd45bf9
commit ad11f2ad6a
2 changed files with 5 additions and 1 deletions

View file

@ -333,7 +333,7 @@ export class URL {
password: baseParts.password,
hostname: baseParts.hostname,
port: baseParts.port,
path: resolvePathFromBase(urlParts.path, baseParts.path),
path: resolvePathFromBase(urlParts.path, baseParts.path || "/"),
query: urlParts.query,
hash: urlParts.hash
};

View file

@ -152,6 +152,10 @@ test(function urlRelativeWithBase(): void {
assertEquals(new URL("../b", "file:///a/a/a").href, "file:///a/b");
});
test(function emptyBasePath(): void {
assertEquals(new URL("", "http://example.com").href, "http://example.com/");
});
test(function deletingAllParamsRemovesQuestionMarkFromURL(): void {
const url = new URL("http://example.com/?param1&param2");
url.searchParams.delete("param1");