@curveball/kernel
Version:
Curveball is a framework writting in Typescript for Node.js
47 lines (46 loc) • 1.73 kB
TypeScript
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import { Readable } from 'node:stream';
import { HeadersInterface, HeadersObject } from './headers.js';
import { Request, Encoding } from './request.js';
export declare class MemoryRequest<T> extends Request<T> {
/**
* List of HTTP Headers
*/
headers: HeadersInterface;
/**
* Contains a parsed, stored representation of the body. It's up to
* middlewares to do the actual parsing.
*/
body: T;
constructor(method: string, requestTarget: string, origin: string, headers?: HeadersInterface | HeadersObject, body?: any, absoluteUrl?: string);
/**
* Internal representation of body.
*
* We keep a private copy so we can maintain compatibility with rawBody.
*/
private originalBody;
/**
* This function returns the request body.
*
* If encoding is not specified, this function returns a Buffer. If encoding
* is specified, it will return a string.
* This function returns the request body.
*
* If encoding is not specified, this function returns a Buffer. If encoding
* is specified, it will return a string.
*
* You can only call this function once. Most likely you'll want a single
* middleware that calls this function and then sets `body`.
*/
rawBody(encoding?: Encoding, limit?: string): Promise<string>;
rawBody(encoding?: undefined, limit?: string): Promise<Buffer>;
/**
* getStream returns a Node.js readable stream.
*
* A stream can typically only be read once.
*/
getStream(): Readable;
private getBody;
}
export default MemoryRequest;