@pact-foundation/pact
Version:
Pact for all things Javascript
62 lines • 2.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RequestWithPluginBuilder = void 0;
const requestBuilder_1 = require("./requestBuilder");
class RequestWithPluginBuilder extends requestBuilder_1.RequestBuilder {
pluginContents(contentType, contents) {
this.interaction.withPluginRequestInteractionContents(contentType, contents);
return this;
}
query(query) {
super.query(query);
return this;
}
headers(headers) {
super.headers(headers);
return this;
}
jsonBody(body) {
super.jsonBody(body);
return this;
}
xmlBody(body) {
super.xmlBody(body);
return this;
}
binaryFile(contentType, file) {
super.binaryFile(contentType, file);
return this;
}
/**
* 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, file, mimePartName, boundary) {
super.multipartBody(contentType, file, mimePartName, boundary);
return this;
}
/**
* 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) {
super.matchingRules(rules);
return this;
}
body(contentType, body) {
super.body(contentType, body);
return this;
}
}
exports.RequestWithPluginBuilder = RequestWithPluginBuilder;
//# sourceMappingURL=requestWithPluginBuilder.js.map