Skip to content

Commit 253ca13

Browse files
committed
Stable
1 parent 8718cd0 commit 253ca13

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+745
-1576
lines changed

dist/Event/ErrorEvent.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ResponseAwareEvent } from './ResponseAwareEvent';
22
import { ServerError } from '../Exception/ServerError';
3-
import { Request } from '../Request';
3+
import { Request } from '../Request/Request';
44
export declare class ErrorEvent extends ResponseAwareEvent {
55
readonly error: ServerError | Error;
66
readonly request: Request;

dist/Event/RenderTemplateEvent.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Request } from '../Request';
1+
import { Request } from '../Request/Request';
22
import { Session } from '../Session/Session';
33
import { ResponseAwareEvent } from './ResponseAwareEvent';
44
export declare class RenderTemplateEvent extends ResponseAwareEvent {

dist/Event/RequestEvent.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ResponseAwareEvent } from './ResponseAwareEvent';
2-
import { Request } from '../Request';
2+
import { Request } from '../Request/Request';
33
import { IRoute } from '../Router/Router';
44
export declare class RequestEvent extends ResponseAwareEvent {
55
readonly request: Request;

dist/Event/ResponseEvent.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Request } from '../Request';
1+
import { Request } from '../Request/Request';
22
import { Response } from '../Response/Response';
33
import { IRoute } from '../Router/Router';
44
export declare class ResponseEvent {

dist/Event/StaticRequestEvent.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ResponseAwareEvent } from '../Event/ResponseAwareEvent';
2-
import { Request } from '../Request';
2+
import { Request } from '../Request/Request';
33
export declare class StaticRequestEvent extends ResponseAwareEvent {
44
readonly request: Request;
55
readonly fileName: string;

dist/Event/StaticResponseEvent.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Request } from '../Request';
1+
import { Request } from '../Request/Request';
22
import { Response } from '../Response/Response';
33
export declare class StaticResponseEvent {
44
readonly request: Request;

dist/Harmony.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export declare class Harmony {
1212
private readonly options;
1313
private readonly router;
1414
private readonly server;
15+
private readonly requestDecoder;
1516
private readonly sessionManager;
1617
private readonly staticAssetHandler;
1718
private readonly templateManager;
@@ -88,6 +89,13 @@ export interface IConstructorOptions {
8889
* Defaults to 8000.
8990
*/
9091
port?: number;
92+
/**
93+
* The maximum size of a request body in bytes.
94+
*
95+
* Make sure to keep this number relatively low to prevent flood attacks.
96+
* Defaults to 1MB.
97+
*/
98+
maxUploadSize?: number;
9199
static?: {
92100
/**
93101
* One or more directories to serve static assets from.

dist/Request.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export declare class Request {
1111
private readonly _cookies;
1212
private readonly _query;
1313
private readonly _path;
14-
constructor(r: IncomingMessage);
14+
private readonly _body;
15+
constructor(r: IncomingMessage, body: Buffer);
1516
/**
1617
* Returns a value from one of the available bags in the following order:
1718
* - cookies

dist/Request/IUploadedFile.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/// <reference types="node" />
2+
export interface IUploadedFile {
3+
name: string;
4+
fileName: string;
5+
mimeType: string;
6+
data: Buffer;
7+
}

dist/Request/MultipartParser.d.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Multipart Parser (Finite State Machine)
3+
* usage:
4+
* const multipart = require('./multipart.js');
5+
* const body = multipart.DemoData(); // raw body
6+
* const body = new Buffer(event['body-json'].toString(),'base64'); // AWS case
7+
* const boundary = multipart.getBoundary(event.params.header['content-type']);
8+
* const parts = multipart.Parse(body,boundary);
9+
* each part is:
10+
* { filename: 'A.txt', type: 'text/plain', data: <Buffer 41 41 41 41 42 42 42 42> }
11+
* or { name: 'key', data: <Buffer 41 41 41 41 42 42 42 42> }
12+
*/
13+
/// <reference types="node" />
14+
declare type Input = {
15+
filename?: string;
16+
name?: string;
17+
type: string;
18+
data: Buffer;
19+
};
20+
export declare function parse(multipartBodyBuffer: Buffer, boundary: string): Input[];
21+
export declare function getBoundary(header: string): string;
22+
export {};

0 commit comments

Comments
 (0)