@curveball/kernel
Version:
Curveball is a framework writting in Typescript for Node.js
38 lines (37 loc) • 1.17 kB
TypeScript
import RequestInterface from './request.js';
import ResponseInterface from './response.js';
/**
* This method will return true or false if a Request or Response has a
* Content-Type header that matches the argument.
*
* For example, if the Content-Type header has the value: application/hal+json,
* then the arguments will all return true:
*
* * application/hal+json
* * application/json
* * hal+json
* * json
* * application/*
*/
export declare function is(message: RequestInterface<any> | ResponseInterface<any>, type: string): boolean;
type Preferences = {
[preference: string]: true | string;
};
/**
* Parses a RFC7240 Prefer header.
*
* It's a naive parser as it assumes a fairly simple subset of
* Prefer.
*
* TODO: Make this parse every possible variation.
*/
export declare function parsePrefer(header: string | null): Preferences;
/**
* This function takes a multi-value comma-separated header and splits it
* into multiple headers.
*
* TODO: In the future this function will respect comma's appearing within
* quotes and ignore them. It doesn't right now.
*/
export declare function splitHeader(header: string): string[];
export {};