mirror of
https://github.com/denoland/deno.git
synced 2024-12-01 16:51:13 -05:00
workaround ipv4 vs ipv6 issues for windows by specifying ip address instead of localhost in problematic situation
This commit is contained in:
parent
5b4aa79fb6
commit
84e1d84bb6
1 changed files with 18 additions and 3 deletions
|
@ -460,7 +460,8 @@ Deno.test("[node/http] send request with non-chunked body", async () => {
|
||||||
let requestHeaders: Headers;
|
let requestHeaders: Headers;
|
||||||
let requestBody = "";
|
let requestBody = "";
|
||||||
|
|
||||||
const hostname = "localhost";
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
|
const hostname = "127.0.0.1";
|
||||||
const port = 4505;
|
const port = 4505;
|
||||||
|
|
||||||
const handler = async (req: Request) => {
|
const handler = async (req: Request) => {
|
||||||
|
@ -517,7 +518,8 @@ Deno.test("[node/http] send request with chunked body", async () => {
|
||||||
let requestHeaders: Headers;
|
let requestHeaders: Headers;
|
||||||
let requestBody = "";
|
let requestBody = "";
|
||||||
|
|
||||||
const hostname = "localhost";
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
|
const hostname = "127.0.0.1";
|
||||||
const port = 4505;
|
const port = 4505;
|
||||||
|
|
||||||
const handler = async (req: Request) => {
|
const handler = async (req: Request) => {
|
||||||
|
@ -564,7 +566,8 @@ Deno.test("[node/http] send request with chunked body as default", async () => {
|
||||||
let requestHeaders: Headers;
|
let requestHeaders: Headers;
|
||||||
let requestBody = "";
|
let requestBody = "";
|
||||||
|
|
||||||
const hostname = "localhost";
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
|
const hostname = "127.0.0.1";
|
||||||
const port = 4505;
|
const port = 4505;
|
||||||
|
|
||||||
const handler = async (req: Request) => {
|
const handler = async (req: Request) => {
|
||||||
|
@ -670,6 +673,7 @@ Deno.test("[node/http] ClientRequest handle non-string headers", async () => {
|
||||||
// deno-lint-ignore no-explicit-any
|
// deno-lint-ignore no-explicit-any
|
||||||
let headers: any;
|
let headers: any;
|
||||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
const req = http.request("http://127.0.0.1:4545/echo_server", {
|
const req = http.request("http://127.0.0.1:4545/echo_server", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { 1: 2 },
|
headers: { 1: 2 },
|
||||||
|
@ -713,6 +717,7 @@ Deno.test("[node/http] ClientRequest setTimeout", async () => {
|
||||||
let body = "";
|
let body = "";
|
||||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||||
const timer = setTimeout(() => reject("timed out"), 50000);
|
const timer = setTimeout(() => reject("timed out"), 50000);
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
const req = http.request("http://127.0.0.1:4545/http_version", (resp) => {
|
const req = http.request("http://127.0.0.1:4545/http_version", (resp) => {
|
||||||
resp.on("data", (chunk) => {
|
resp.on("data", (chunk) => {
|
||||||
body += chunk;
|
body += chunk;
|
||||||
|
@ -734,6 +739,7 @@ Deno.test("[node/http] ClientRequest setNoDelay", async () => {
|
||||||
let body = "";
|
let body = "";
|
||||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||||
const timer = setTimeout(() => reject("timed out"), 50000);
|
const timer = setTimeout(() => reject("timed out"), 50000);
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
const req = http.request("http://127.0.0.1:4545/http_version", (resp) => {
|
const req = http.request("http://127.0.0.1:4545/http_version", (resp) => {
|
||||||
resp.on("data", (chunk) => {
|
resp.on("data", (chunk) => {
|
||||||
body += chunk;
|
body += chunk;
|
||||||
|
@ -754,6 +760,7 @@ Deno.test("[node/http] ClientRequest setNoDelay", async () => {
|
||||||
Deno.test("[node/http] ClientRequest PATCH", async () => {
|
Deno.test("[node/http] ClientRequest PATCH", async () => {
|
||||||
let body = "";
|
let body = "";
|
||||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
const req = http.request("http://127.0.0.1:4545/echo_server", {
|
const req = http.request("http://127.0.0.1:4545/echo_server", {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
}, (resp) => {
|
}, (resp) => {
|
||||||
|
@ -776,6 +783,7 @@ Deno.test("[node/http] ClientRequest PATCH", async () => {
|
||||||
Deno.test("[node/http] ClientRequest PUT", async () => {
|
Deno.test("[node/http] ClientRequest PUT", async () => {
|
||||||
let body = "";
|
let body = "";
|
||||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
const req = http.request("http://127.0.0.1:4545/echo_server", {
|
const req = http.request("http://127.0.0.1:4545/echo_server", {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
}, (resp) => {
|
}, (resp) => {
|
||||||
|
@ -799,6 +807,7 @@ Deno.test("[node/http] ClientRequest search params", async () => {
|
||||||
let body = "";
|
let body = "";
|
||||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||||
const req = http.request({
|
const req = http.request({
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
host: "127.0.0.1",
|
host: "127.0.0.1",
|
||||||
port: 4545,
|
port: 4545,
|
||||||
path: "/search_params?foo=bar",
|
path: "/search_params?foo=bar",
|
||||||
|
@ -925,6 +934,7 @@ Deno.test(
|
||||||
let body = "";
|
let body = "";
|
||||||
|
|
||||||
const request = http.request(
|
const request = http.request(
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
"http://127.0.0.1:5928/",
|
"http://127.0.0.1:5928/",
|
||||||
(resp) => {
|
(resp) => {
|
||||||
resp.on("data", (chunk) => {
|
resp.on("data", (chunk) => {
|
||||||
|
@ -993,6 +1003,7 @@ Deno.test(
|
||||||
);
|
);
|
||||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||||
|
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
const request = http.request("http://127.0.0.1:5929/");
|
const request = http.request("http://127.0.0.1:5929/");
|
||||||
request.on("error", reject);
|
request.on("error", reject);
|
||||||
request.on("close", () => {});
|
request.on("close", () => {});
|
||||||
|
@ -1013,6 +1024,7 @@ Deno.test(
|
||||||
"[node/http] client destroy before sending request should not error",
|
"[node/http] client destroy before sending request should not error",
|
||||||
async () => {
|
async () => {
|
||||||
const { resolve, promise } = Promise.withResolvers<void>();
|
const { resolve, promise } = Promise.withResolvers<void>();
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
const request = http.request("http://localhost:5929/");
|
const request = http.request("http://localhost:5929/");
|
||||||
// Calling this would throw
|
// Calling this would throw
|
||||||
request.destroy();
|
request.destroy();
|
||||||
|
@ -1569,6 +1581,7 @@ Deno.test("[node/http] ClientRequest PUT subarray", async () => {
|
||||||
const payload = buffer.subarray(6, 11);
|
const payload = buffer.subarray(6, 11);
|
||||||
let body = "";
|
let body = "";
|
||||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
const req = http.request("http://127.0.0.1:4545/echo_server", {
|
const req = http.request("http://127.0.0.1:4545/echo_server", {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
}, (resp) => {
|
}, (resp) => {
|
||||||
|
@ -1609,6 +1622,7 @@ Deno.test("[node/http] ClientRequest content-disposition header works", async ()
|
||||||
let body = "";
|
let body = "";
|
||||||
let headers = {} as http.IncomingHttpHeaders;
|
let headers = {} as http.IncomingHttpHeaders;
|
||||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
const req = http.request("http://127.0.0.1:4545/echo_server", {
|
const req = http.request("http://127.0.0.1:4545/echo_server", {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -1635,6 +1649,7 @@ Deno.test("[node/http] In ClientRequest, option.hostname has precedence over opt
|
||||||
const responseReceived = Promise.withResolvers<void>();
|
const responseReceived = Promise.withResolvers<void>();
|
||||||
|
|
||||||
new http.ClientRequest({
|
new http.ClientRequest({
|
||||||
|
// TODO(kt3k): This should be "localhost" when we implemented happy-eyeballs for node:net
|
||||||
hostname: "127.0.0.1",
|
hostname: "127.0.0.1",
|
||||||
host: "invalid-hostname.test",
|
host: "invalid-hostname.test",
|
||||||
port: 4545,
|
port: 4545,
|
||||||
|
|
Loading…
Reference in a new issue