1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

chore(std/http): server module name migration (#11890)

This commit is contained in:
Craig Morten 2021-09-05 21:43:46 +01:00 committed by GitHub
parent 01bfb7d913
commit 930cb0afd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 11 deletions

View file

@ -89,7 +89,7 @@ jobs:
- name: Install Deno - name: Install Deno
if: matrix.job == 'lint' if: matrix.job == 'lint'
run: | run: |
curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.11.3 curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.13.2
echo "$HOME/.deno/bin" >> $GITHUB_PATH echo "$HOME/.deno/bin" >> $GITHUB_PATH
- name: Install Python - name: Install Python

View file

@ -1,5 +1,5 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
import { serve, ServerRequest } from "../test_util/std/http/server.ts"; import { serve, ServerRequest } from "../test_util/std/http/server_legacy.ts";
const addr = Deno.args[0] || "127.0.0.1:4500"; const addr = Deno.args[0] || "127.0.0.1:4500";
const originAddr = Deno.args[1] || "127.0.0.1:4501"; const originAddr = Deno.args[1] || "127.0.0.1:4501";

View file

@ -1,5 +1,8 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
import { serve, ServerRequest } from "../../../test_util/std/http/server.ts"; import {
serve,
ServerRequest,
} from "../../../test_util/std/http/server_legacy.ts";
import { assertEquals } from "../../../test_util/std/testing/asserts.ts"; import { assertEquals } from "../../../test_util/std/testing/asserts.ts";
const addr = Deno.args[1] || "127.0.0.1:4555"; const addr = Deno.args[1] || "127.0.0.1:4555";

View file

@ -6,8 +6,8 @@ import { TextProtoReader } from "../../../test_util/std/textproto/mod.ts";
import { import {
assert, assert,
assertEquals, assertEquals,
assertRejects,
assertThrows, assertThrows,
assertThrowsAsync,
deferred, deferred,
delay, delay,
fail, fail,
@ -187,7 +187,7 @@ unitTest({ perms: { net: true } }, async function httpServerInvalidMethod() {
const client = await Deno.connect({ port: 4501 }); const client = await Deno.connect({ port: 4501 });
const httpConn = Deno.serveHttp(await listener.accept()); const httpConn = Deno.serveHttp(await listener.accept());
await client.write(new Uint8Array([1, 2, 3])); await client.write(new Uint8Array([1, 2, 3]));
await assertThrowsAsync( await assertRejects(
async () => { async () => {
await httpConn.nextRequest(); await httpConn.nextRequest();
}, },
@ -277,8 +277,8 @@ unitTest(
const event = await httpConn.nextRequest(); const event = await httpConn.nextRequest();
assert(event); assert(event);
const { respondWith } = event; const { respondWith } = event;
let cancelReason = null; let cancelReason: string;
const responseError = await assertThrowsAsync( await assertRejects(
async () => { async () => {
let interval = 0; let interval = 0;
await respondWith( await respondWith(
@ -299,8 +299,9 @@ unitTest(
); );
}, },
Deno.errors.Http, Deno.errors.Http,
cancelReason!,
); );
assertEquals(cancelReason, responseError); assert(cancelReason!);
httpConn.close(); httpConn.close();
listener.close(); listener.close();
})(); })();
@ -323,7 +324,7 @@ unitTest(
// Start polling for the next request before awaiting response. // Start polling for the next request before awaiting response.
const nextRequestPromise = httpConn.nextRequest(); const nextRequestPromise = httpConn.nextRequest();
const { respondWith } = event; const { respondWith } = event;
await assertThrowsAsync( await assertRejects(
async () => { async () => {
let interval = 0; let interval = 0;
await respondWith( await respondWith(
@ -710,7 +711,7 @@ unitTest(function httpUpgradeWebSocketCaseInsensitiveUpgradeHeader() {
const request = new Request("https://deno.land/", { const request = new Request("https://deno.land/", {
headers: { headers: {
connection: "upgrade", connection: "upgrade",
upgrade: "WebSocket", upgrade: "websocket",
"sec-websocket-key": "dGhlIHNhbXBsZSBub25jZQ==", "sec-websocket-key": "dGhlIHNhbXBsZSBub25jZQ==",
}, },
}); });

View file

@ -12,6 +12,7 @@ export {
assertEquals, assertEquals,
assertMatch, assertMatch,
assertNotEquals, assertNotEquals,
assertRejects,
assertStrictEquals, assertStrictEquals,
assertStringIncludes, assertStringIncludes,
assertThrows, assertThrows,

@ -1 +1 @@
Subproject commit 81314bcab8b5dc2fef85ec65f8588cab17063378 Subproject commit ca23a1e6035ebf34152ab1f20b46f1c3c9a11a5b