UNPKG

@microsoft.azure/autorest.testserver

Version:
62 lines (61 loc) 2.35 kB
import { RequestExt } from "../server"; /** * Class containing all the expectations that can be run on the request. */ export declare class RequestExpectation { private originalRequest; constructor(originalRequest: RequestExt); /** * Expect the raw body of the request to match the given string. * @param rawBody Raw request body. * @throws {ValidationError} if there is an error. */ rawBodyEquals(expectedRawBody: string | undefined): void; /** * Expect the body of the request to match the given object. * @param rawBody Raw request body. * @throws {ValidationError} if there is an error. */ bodyEquals(expectedRawBody: unknown | undefined): void; /** * Expect the coerced body of the request to match the given object. * @param rawBody Raw request body. * @throws {ValidationError} if there is an error. */ coercedBodyEquals(expectedRawBody: unknown | undefined): void; /** * Expect the body of the request to be empty. * @throws {ValidationError} if there is an error. */ bodyEmpty(): void; /** * Expect the body of the request to be not empty. * @throws {ValidationError} if there is an error. */ bodyNotEmpty(): void; /** * Expect the body of the request matches the XML body you expect * @param expectedRawBody Raw request XML body expressed in a string. * @throws {ValidationError} if there is an error. */ xmlBodyEquals(expectedRawBody: string): Promise<void>; /** * Expect the header of the request contains the expected key/value pair * @param headerName Key expected in header * @param expectedValue Values expected in header * @throws {ValidationError} if there is an error. */ containsHeader(headerName: string, expectedValue: string): void; /** * Expect the query string of the request contains the expected name/value pair. * @param paramName Name of the query parameter. * @param expectedValue Value expected of the query parameter. */ containsQueryParam(paramName: string, expectedValue: string): void; /** * Check if two requests are equal * @param actual Actual value * @param expected Expected value */ deepEqual(actual: unknown, expected: unknown, message?: string): void; }