1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-28 10:09:20 -05:00
Original: 5d0dd5878e
This commit is contained in:
Ryan Dahl 2019-09-26 21:06:59 -04:00 committed by GitHub
parent aa21e7bc81
commit af18093498
5 changed files with 7 additions and 5 deletions

View file

@ -1,5 +1,5 @@
variables: variables:
DENO_VERSION: "v0.18.0" DENO_VERSION: "v0.19.0"
TS_VERSION: "3.4.5" TS_VERSION: "3.4.5"
# TODO Try to get eslint to run under Deno, like prettier # TODO Try to get eslint to run under Deno, like prettier

View file

@ -50,7 +50,7 @@ World 4
test(async function serverPipelineRace(): Promise<void> { test(async function serverPipelineRace(): Promise<void> {
await startServer(); await startServer();
const conn = await dial("tcp", "127.0.0.1:4501"); const conn = await dial({ port: 4501 });
const r = new TextProtoReader(new BufReader(conn)); const r = new TextProtoReader(new BufReader(conn));
await conn.write(new TextEncoder().encode(input)); await conn.write(new TextEncoder().encode(input));
const outLines = output.split("\n"); const outLines = output.split("\n");

View file

@ -386,7 +386,9 @@ export class Server implements AsyncIterable<ServerRequest> {
} }
export function serve(addr: string): Server { export function serve(addr: string): Server {
const listener = listen("tcp", addr); // TODO(ry) Update serve to also take { hostname, port }.
const [hostname, port] = addr.split(":");
const listener = listen({ hostname, port: Number(port) });
return new Server(listener); return new Server(listener);
} }

View file

@ -512,7 +512,7 @@ test({
await delay(100); await delay(100);
// Reqeusts to the server and immediately closes the connection // Reqeusts to the server and immediately closes the connection
const conn = await Deno.dial("tcp", "127.0.0.1:4502"); const conn = await Deno.dial({ port: 4502 });
await conn.write(new TextEncoder().encode("GET / HTTP/1.0\n\n")); await conn.write(new TextEncoder().encode("GET / HTTP/1.0\n\n"));
conn.close(); conn.close();

View file

@ -488,7 +488,7 @@ export async function connectWebSocket(
throw new Error("currently https/wss is not supported"); throw new Error("currently https/wss is not supported");
} }
} }
const conn = await Deno.dial("tcp", `${hostname}:${port}`); const conn = await Deno.dial({ hostname, port: Number(port) });
const bufWriter = new BufWriter(conn); const bufWriter = new BufWriter(conn);
const bufReader = new BufReader(conn); const bufReader = new BufReader(conn);
try { try {