@ublitzjs/core 0.1.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -14
- package/dist/cjs/http-codes.js +99 -0
- package/dist/cjs/http-headers.js +118 -0
- package/dist/cjs/index.js +104 -0
- package/dist/esm/http-codes.js +84 -0
- package/dist/esm/http-headers.js +119 -0
- package/dist/esm/index.js +71 -0
- package/dist/esm/package.json +1 -0
- package/dist/types/http-codes.d.ts +43 -0
- package/dist/types/http-headers.d.ts +1040 -0
- package/dist/types/index.d.ts +249 -0
- package/package.json +33 -7
- package/USAGE.md +0 -319
- package/cjs/http-codes.cjs +0 -56
- package/cjs/http-headers.cjs +0 -64
- package/cjs/index.cjs +0 -61
- package/logo.png +0 -0
- package/mjs/http-codes.mjs +0 -52
- package/mjs/http-headers.mjs +0 -63
- package/mjs/index.mjs +0 -51
- package/tsconfig.json +0 -41
- package/types/http-codes.d.ts +0 -54
- package/types/http-headers.d.ts +0 -1079
- package/types/index.d.ts +0 -170
- package/types/uws-types.d.ts +0 -123
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { HttpResponse as uwsHttpResponse } from "uWebSockets.js";
|
|
2
|
+
import type { HttpRequest, HttpMethods } from "./index.ts";
|
|
3
|
+
/**
|
|
4
|
+
* If something wrong is to content-length, sends 411 code and throws error with a "cause" == { CL : string}, sets res.finished = true
|
|
5
|
+
*/
|
|
6
|
+
export declare function checkContentLength(res: uwsHttpResponse, req: HttpRequest): number;
|
|
7
|
+
/**
|
|
8
|
+
* sends http 400 and throws an Error with "causeForYou", sets res.finished = true
|
|
9
|
+
*/
|
|
10
|
+
export declare function badRequest(res: uwsHttpResponse, error: string, causeForYou: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* sends http 413, but doesn't throw an Error, sets res.finished = true
|
|
13
|
+
*/
|
|
14
|
+
export declare function tooLargeBody(res: uwsHttpResponse, limit: number): void;
|
|
15
|
+
/**
|
|
16
|
+
* Constructs function, which sends http 405 and sets http Allow header with all methods you passed.
|
|
17
|
+
* It ignores "ws" and replaces "del" on "DELETE"
|
|
18
|
+
*/
|
|
19
|
+
export declare function seeOtherMethods(methodsArr: HttpMethods[]): (res: uwsHttpResponse, req: any) => any;
|
|
20
|
+
/**
|
|
21
|
+
* Constructs the function, which sets 404 http code and sends the message you have specified
|
|
22
|
+
*/
|
|
23
|
+
export declare function notFoundConstructor(message?: string): (res: uwsHttpResponse, req: any) => any;
|
|
24
|
+
/**
|
|
25
|
+
* code: required content length
|
|
26
|
+
*/
|
|
27
|
+
export declare var c411: ArrayBuffer;
|
|
28
|
+
/**
|
|
29
|
+
* code: bad request
|
|
30
|
+
*/
|
|
31
|
+
export declare var c400: ArrayBuffer;
|
|
32
|
+
/**
|
|
33
|
+
* code: payload too large
|
|
34
|
+
*/
|
|
35
|
+
export declare var c413: ArrayBuffer;
|
|
36
|
+
/**
|
|
37
|
+
* code: method not allowed
|
|
38
|
+
*/
|
|
39
|
+
export declare var c405: ArrayBuffer;
|
|
40
|
+
/**
|
|
41
|
+
* code: not found
|
|
42
|
+
*/
|
|
43
|
+
export declare var c404: ArrayBuffer;
|