mirror of
https://github.com/denoland/deno.git
synced 2024-11-26 16:09:27 -05:00
Fix jsdoc in std/http/server.ts (#3284)
This commit is contained in:
parent
25c276055b
commit
709cb3c9ba
1 changed files with 17 additions and 14 deletions
|
@ -228,9 +228,11 @@ function fixLength(req: ServerRequest): void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseHTTPVersion parses a HTTP version string.
|
/**
|
||||||
// "HTTP/1.0" returns (1, 0, true).
|
* ParseHTTPVersion parses a HTTP version string.
|
||||||
// Ported from https://github.com/golang/go/blob/f5c43b9/src/net/http/request.go#L766-L792
|
* "HTTP/1.0" returns (1, 0, true).
|
||||||
|
* Ported from https://github.com/golang/go/blob/f5c43b9/src/net/http/request.go#L766-L792
|
||||||
|
*/
|
||||||
export function parseHTTPVersion(vers: string): [number, number] {
|
export function parseHTTPVersion(vers: string): [number, number] {
|
||||||
switch (vers) {
|
switch (vers) {
|
||||||
case "HTTP/1.1":
|
case "HTTP/1.1":
|
||||||
|
@ -450,19 +452,20 @@ export function serveTLS(options: HTTPSOptions): Server {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an HTTPS server with given options and request handler
|
* Create an HTTPS server with given options and request handler
|
||||||
|
*
|
||||||
|
* const body = new TextEncoder().encode("Hello HTTPS");
|
||||||
|
* const options = {
|
||||||
|
* hostname: "localhost",
|
||||||
|
* port: 443,
|
||||||
|
* certFile: "./path/to/localhost.crt",
|
||||||
|
* keyFile: "./path/to/localhost.key",
|
||||||
|
* };
|
||||||
|
* listenAndServeTLS(options, (req) => {
|
||||||
|
* req.respond({ body });
|
||||||
|
* });
|
||||||
|
*
|
||||||
* @param options Server configuration
|
* @param options Server configuration
|
||||||
* @param handler Request handler
|
* @param handler Request handler
|
||||||
*
|
|
||||||
* const body = new TextEncoder().encode("Hello HTTPS");
|
|
||||||
* const options = {
|
|
||||||
* hostname: "localhost",
|
|
||||||
* port: 443,
|
|
||||||
* certFile: "./path/to/localhost.crt",
|
|
||||||
* keyFile: "./path/to/localhost.key",
|
|
||||||
* };
|
|
||||||
* listenAndServeTLS(options, (req) => {
|
|
||||||
* req.respond({ body });
|
|
||||||
* });
|
|
||||||
*/
|
*/
|
||||||
export async function listenAndServeTLS(
|
export async function listenAndServeTLS(
|
||||||
options: HTTPSOptions,
|
options: HTTPSOptions,
|
||||||
|
|
Loading…
Reference in a new issue