UNPKG

@serenity-js/core

Version:

The core Serenity/JS framework, providing the Screenplay Pattern interfaces, as well as the test reporting and integration infrastructure

32 lines (28 loc) 865 B
import type { JSONObject } from 'tiny-types'; import { JSONData } from './JSONData'; /** * The value of the `HTTPRequestResponse` artifact describing an HTTP request/response pair. */ export interface RequestAndResponse extends JSONObject { request: { url: string; method: string; headers: Record<string, string | number | boolean>; data?: any; }; response: { status: number; data?: any; headers?: Record<string, string> & { 'set-cookie'?: string[] }; }; } /** * An artifact describing a HTTP request/response pair. */ export class HTTPRequestResponse extends JSONData { static fromJSON(value: RequestAndResponse): HTTPRequestResponse { return new HTTPRequestResponse(Buffer.from(JSON.stringify(value, undefined, 0), 'utf8').toString('base64')); } }