UNPKG

@pact-foundation/pact

Version:
40 lines 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GraphQLRequestBuilder = void 0; const ramda_1 = require("ramda"); const matchers_1 = require("../../v3/matchers"); class GraphQLRequestBuilder { interaction; // tslint:disable:no-empty-function constructor(interaction) { this.interaction = interaction; } query(query) { (0, ramda_1.forEachObjIndexed)((v, k) => { if (Array.isArray(v)) { v.forEach((vv, i) => { this.interaction.withQuery(k, i, (0, matchers_1.matcherValueOrString)(vv)); }); } else { this.interaction.withQuery(k, 0, (0, matchers_1.matcherValueOrString)(v)); } }, query); return this; } headers(headers) { (0, ramda_1.forEachObjIndexed)((v, k) => { if (Array.isArray(v)) { v.forEach((header, index) => { this.interaction.withRequestHeader(`${k}`, index, (0, matchers_1.matcherValueOrString)(header)); }); } else { this.interaction.withRequestHeader(`${k}`, 0, (0, matchers_1.matcherValueOrString)(v)); } }, headers); return this; } } exports.GraphQLRequestBuilder = GraphQLRequestBuilder; //# sourceMappingURL=graphQLRequestBuilder.js.map