summaryrefslogtreecommitdiff
path: root/cli/dts/lib.deno.unstable.d.ts
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2021-07-12 12:44:49 +0200
committerGitHub <noreply@github.com>2021-07-12 12:44:49 +0200
commitf649960f87a408124b5b0d6f55f3be7f5724a4e7 (patch)
tree0a303a918828f602623c64c50a912645df55b772 /cli/dts/lib.deno.unstable.d.ts
parent6460eadaa178b3a9d09d04205977e4f659fe8fff (diff)
refactor: deno_http op crate (#11335)
Diffstat (limited to 'cli/dts/lib.deno.unstable.d.ts')
-rw-r--r--cli/dts/lib.deno.unstable.d.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts
index ac03e695c..199f05631 100644
--- a/cli/dts/lib.deno.unstable.d.ts
+++ b/cli/dts/lib.deno.unstable.d.ts
@@ -3,6 +3,7 @@
/// <reference no-default-lib="true" />
/// <reference lib="deno.ns" />
/// <reference lib="deno.net_unstable" />
+/// <reference lib="deno.http_unstable" />
declare namespace Deno {
/**
@@ -1098,6 +1099,24 @@ declare namespace Deno {
write?: "inherit" | boolean | Array<string | URL>;
};
}
+
+ /** **UNSTABLE**: new API, yet to be vetted.
+ *
+ * Services HTTP requests given a TCP or TLS socket.
+ *
+ * ```ts
+ * const conn = await Deno.connect({ port: 80, hostname: "127.0.0.1" });
+ * const httpConn = Deno.serveHttp(conn);
+ * const e = await httpConn.nextRequest();
+ * if (e) {
+ * e.respondWith(new Response("Hello World"));
+ * }
+ * ```
+ *
+ * If `httpConn.nextRequest()` encounters an error or returns `null`
+ * then the underlying HttpConn resource is closed automatically.
+ */
+ export function serveHttp(conn: Conn): HttpConn;
}
declare function fetch(