summaryrefslogtreecommitdiff
path: root/cli/dts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/dts')
-rw-r--r--cli/dts/lib.deno.ns.d.ts29
-rw-r--r--cli/dts/lib.deno.unstable.d.ts18
2 files changed, 29 insertions, 18 deletions
diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts
index 469b8a329..37cc58ad6 100644
--- a/cli/dts/lib.deno.ns.d.ts
+++ b/cli/dts/lib.deno.ns.d.ts
@@ -2414,4 +2414,33 @@ declare namespace Deno {
* ```
*/
export function fstat(rid: number): Promise<FileInfo>;
+
+ export interface RequestEvent {
+ readonly request: Request;
+ respondWith(r: Response | Promise<Response>): Promise<void>;
+ }
+
+ export interface HttpConn extends AsyncIterable<RequestEvent> {
+ readonly rid: number;
+
+ nextRequest(): Promise<RequestEvent | null>;
+ close(): void;
+ }
+
+ /**
+ * 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;
}
diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts
index 442da1e53..0ac829463 100644
--- a/cli/dts/lib.deno.unstable.d.ts
+++ b/cli/dts/lib.deno.unstable.d.ts
@@ -1076,24 +1076,6 @@ 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(