From d9d3f81f291bbba4ab526f1781ca78e8a00cba64 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Thu, 18 Apr 2024 11:21:25 -0600 Subject: chore: remove unused, unstable 'http' namespace (#23436) Landing parts of #21903 in preparation for the removal of serveHttp. --- ext/http/01_http.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ext') 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 }; -- cgit v1.2.3