Fix for issue denoland/deno#6685: --allow-net=:8080 broken (denoland/deno#6698)

This commit is contained in:
KrisChambers 2020-07-10 22:37:20 -04:00 committed by denobot
parent fae1aba117
commit 2cda6fbd3c
2 changed files with 2 additions and 1 deletions

View File

@ -263,7 +263,7 @@ export function _parseAddrFromStr(addr: string): HTTPOptions {
}
return {
hostname: url.hostname,
hostname: url.hostname == "" ? "0.0.0.0" : url.hostname,
port: url.port === "" ? 80 : Number(url.port),
};
}

View File

@ -665,5 +665,6 @@ Deno.test({
fn: (): void => {
const addr = _parseAddrFromStr(":80");
assertEquals(addr.port, 80);
assertEquals(addr.hostname, "0.0.0.0");
},
});