mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
API change: Deno.startHttp -> Deno.serveHttp (#10087)
This commit is contained in:
parent
cd0560210a
commit
c6e7a243d5
5 changed files with 20 additions and 18 deletions
16
cli/dts/lib.deno.unstable.d.ts
vendored
16
cli/dts/lib.deno.unstable.d.ts
vendored
|
@ -1211,18 +1211,20 @@ declare namespace Deno {
|
|||
|
||||
/** **UNSTABLE**: new API, yet to be vetted.
|
||||
*
|
||||
* Parse HTTP requests from the given connection
|
||||
* Services HTTP requests given a TCP or TLS socket.
|
||||
*
|
||||
* ```ts
|
||||
* const httpConn = await Deno.startHttp(conn);
|
||||
* const { request, respondWith } = await httpConn.next();
|
||||
* respondWith(new Response("Hello World"));
|
||||
* const httpConn = Deno.serveHttp(conn);
|
||||
* const e = await httpConn.nextRequest();
|
||||
* if (e) {
|
||||
* e.respondWith(new Response("Hello World"));
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* If `httpConn.next()` encounters an error or returns `done == true` then
|
||||
* the underlying HttpConn resource is closed automatically.
|
||||
* If `httpConn.nextRequest()` encounters an error or returns `null`
|
||||
* then the underlying HttpConn resource is closed automatically.
|
||||
*/
|
||||
export function startHttp(conn: Conn): HttpConn;
|
||||
export function serveHttp(conn: Conn): HttpConn;
|
||||
}
|
||||
|
||||
declare function fetch(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue