UNPKG

@ply-ct/ply

Version:

REST API Automated Testing

48 lines (47 loc) 1.4 kB
import { Options } from './options'; export interface Status { code: number; message: string; } export interface Response { status: Status; headers: { [key: string]: string; }; /** * Body can be text, object, ArrayBuffer, or undefined. */ body?: any; submitted?: Date; time?: number; } export declare class PlyResponse implements Response { readonly runId: string; readonly status: Status; readonly headers: { [key: string]: string; }; readonly body?: any; readonly time?: number | undefined; constructor(runId: string, status: Status, headers: { [key: string]: string; }, body?: any, time?: number | undefined); /** * Orders body object keys unless suppressed by options. * Sorts arrays if... * Does not substitute values. * Response header keys are always lowercase. * Binary response body is base64 encoded. * @param runId * @param options * @param wantedHeaders optional name of headers subset to keep * @param stringBody body object is stringified (windows eols are replaced if prettyIndent) */ getResponse(runId: string, options: Options, massagers?: ResponseMassagers, stringBody?: boolean): PlyResponse; } export interface ResponseMassagers { headers?: string[]; arraySorts?: { [expr: string]: string; }; }