@pact-foundation/pact
Version:
Pact for all things Javascript
33 lines (32 loc) • 2.07 kB
TypeScript
import type { Rules, TemplateHeaders, TemplateQuery } from '../../v3';
import { RequestBuilder } from './requestBuilder';
import type { V4RequestWithPluginBuilder } from './types';
export declare class RequestWithPluginBuilder extends RequestBuilder implements V4RequestWithPluginBuilder {
pluginContents(contentType: string, contents: string): V4RequestWithPluginBuilder;
query(query: TemplateQuery): V4RequestWithPluginBuilder;
headers(headers: TemplateHeaders): V4RequestWithPluginBuilder;
jsonBody(body: unknown): V4RequestWithPluginBuilder;
xmlBody(body: unknown): V4RequestWithPluginBuilder;
binaryFile(contentType: string, file: string): V4RequestWithPluginBuilder;
/**
* Sets the request body as multipart/form-data content for plugin-based interactions.
* This is useful for testing APIs that accept file uploads or multipart form submissions.
*
* @param contentType - The content type of the multipart body (e.g., 'multipart/form-data')
* @param file - Path to the file containing the multipart body content
* @param mimePartName - The name of the mime part in the multipart body
* @param boundary - Optional boundary string for the multipart content. If not provided, will be passed as undefined.
* @returns The V4RequestWithPluginBuilder instance for method chaining
*/
multipartBody(contentType: string, file: string, mimePartName: string, boundary?: string): V4RequestWithPluginBuilder;
/**
* Applies matching rules to the consumer request.
* Matching rules allow you to define flexible matching criteria for request attributes
* beyond exact equality (e.g., regex patterns, type matching, number ranges).
*
* @param rules - The matching rules as a strongly typed Rules object. Rules should follow the Pact matching rules format.
* @returns The V4RequestWithPluginBuilder instance for method chaining
*/
matchingRules(rules: Rules): V4RequestWithPluginBuilder;
body(contentType: string, body: Buffer): V4RequestWithPluginBuilder;
}