UNPKG

812 BTypeScriptView Raw
1// Type definitions for content-type 1.1
2// Project: https://github.com/jshttp/content-type
3// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
4// BendingBender <https://github.com/BendingBender>
5// Definitions: https://github.com/borisyankov/DefinitelyTyped
6
7export function parse(input: RequestLike | ResponseLike | string): ParsedMediaType;
8export function format(obj: MediaType): string;
9
10export interface ParsedMediaType {
11 type: string;
12 parameters: {[key: string]: string};
13}
14
15export interface MediaType {
16 type: string;
17 parameters?: {[key: string]: string};
18}
19
20export interface RequestLike {
21 headers: {[header: string]: string | string[] | undefined};
22}
23
24export interface ResponseLike {
25 getHeader(name: string): number | string | string[] | undefined;
26}