From 20b2fe7f6725f891b6f7f955c076afe3a51664a9 Mon Sep 17 00:00:00 2001 From: pavulon Date: Sat, 24 Oct 2020 19:56:18 +0200 Subject: [PATCH] Update TS definitions (#376) --- docs/index.d.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/index.d.ts b/docs/index.d.ts index e3fc5b8..2bf2eae 100644 --- a/docs/index.d.ts +++ b/docs/index.d.ts @@ -191,8 +191,10 @@ export interface HttpRequest { getUrl() : string; /** Returns the HTTP method, useful for "any" routes. */ getMethod() : string; - /** Returns the part of URL after ? sign or empty string. */ + /** Returns the raw querystring (the part of URL after ? sign) or empty string. */ getQuery() : string; + /** Returns a decoded query parameter value or empty string. */ + getQuery(key: string) : string; /** Loops over all headers. */ forEach(cb: (key: string, value: string) => void) : void; /** Setting yield to true is to say that this route handler did not handle the route, causing the router to continue looking for a matching route handler, or fail. */ @@ -291,6 +293,16 @@ export function SSLApp(options: AppOptions): TemplatedApp; /** Closes a uSockets listen socket. */ export function us_listen_socket_close(listenSocket: us_listen_socket): void; +export interface MultipartField { + data: ArrayBuffer; + name: string; + type?: string; + filename?: string; +} + +/** Takes a POSTed body and contentType, and returns an array of parts if the request is a multipart request */ +export function getParts(body: RecognizedString, contentType: RecognizedString): MultipartField[] | undefined; + /** WebSocket compression options */ export type CompressOptions = number; /** No compression (always a good idea if you operate using an efficient binary protocol) */