summaryrefslogtreecommitdiff
path: root/ext/http/01_http.js
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2024-04-18 11:21:25 -0600
committerGitHub <noreply@github.com>2024-04-18 11:21:25 -0600
commitd9d3f81f291bbba4ab526f1781ca78e8a00cba64 (patch)
treed3b09207a9ea1108a0eadd998b46f0d39dada83b /ext/http/01_http.js
parent6a09a16d710b2d7a9d39478e5bcbabb40919d657 (diff)
chore: remove unused, unstable 'http' namespace (#23436)
Landing parts of #21903 in preparation for the removal of serveHttp.
Diffstat (limited to 'ext/http/01_http.js')
-rw-r--r--ext/http/01_http.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/ext/http/01_http.js b/ext/http/01_http.js
index a312cf60e..b41c36446 100644
--- a/ext/http/01_http.js
+++ b/ext/http/01_http.js
@@ -4,11 +4,13 @@ import { core, internals, primordials } from "ext:core/mod.js";
const {
BadResourcePrototype,
InterruptedPrototype,
+ internalRidSymbol,
} = core;
import {
op_http_accept,
op_http_headers,
op_http_shutdown,
+ op_http_start,
op_http_upgrade_websocket,
op_http_websocket_accept_header,
op_http_write,
@@ -71,7 +73,6 @@ import {
readableStreamForRid,
ReadableStreamPrototype,
} from "ext:deno_web/06_streams.js";
-import { serve } from "ext:deno_http/00_serve.js";
import { SymbolDispose } from "ext:deno_web/00_infra.js";
const connErrorSymbol = Symbol("connError");
@@ -557,4 +558,14 @@ function buildCaseInsensitiveCommaValueFinder(checkText) {
internals.buildCaseInsensitiveCommaValueFinder =
buildCaseInsensitiveCommaValueFinder;
-export { _ws, HttpConn, serve, upgradeWebSocket };
+function serveHttp(conn) {
+ internals.warnOnDeprecatedApi(
+ "Deno.serveHttp()",
+ new Error().stack,
+ "Use `Deno.serve()` instead.",
+ );
+ const rid = op_http_start(conn[internalRidSymbol]);
+ return new HttpConn(rid, conn.remoteAddr, conn.localAddr);
+}
+
+export { _ws, HttpConn, serveHttp, upgradeWebSocket };