Skip to content

Commit

Permalink
feat(custom-headers): allow user to specify custom headers during pro…
Browse files Browse the repository at this point in the history
…vider verification
  • Loading branch information
mefellows committed Dec 4, 2017
1 parent 4b8b798 commit 3797193
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ pact.verifyPacts({
pactBrokerUsername: <String>, // Username for Pact Broker basic authentication. Optional.
pactBrokerPassword: <String>, // Password for Pact Broker basic authentication. Optional
publishVerificationResult: <Boolean> // Publish verification result to Broker. Optional
customProviderHeaders: <Array> // Header(s) to add to provider state set up and pact verification requests. eg 'Authorization: Basic cGFjdDpwYWN0'.
providerVersion: <Boolean> // Provider version, required to publish verification result to Broker. Optional otherwise.
timeout: <Number> // The duration in ms we should wait to confirm verification process was successful. Defaults to 30000, Optional.
});
Expand Down
1 change: 1 addition & 0 deletions bin/pact-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ cli
.option("-v, --provider-version [version]", "Provider version, required to publish verification result to Broker.")
.option("-t, --timeout [milliseconds]", "The duration in ms we should wait to confirm verification process was successful. Defaults to 30000.", cli.INT)
.option("-pub, --publish-verification-result", "Publish verification result to Broker.")
.option("-c, --custom-provider-header", "Header to add to provider state set up and pact verification requests. eg 'Authorization: Basic cGFjdDpwYWN0'.", cli.LIST)
.action((args: any, options: any) => pact.verifyPacts(options));

cli.parse(process.argv);
4 changes: 3 additions & 1 deletion src/verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export class Verifier {
"pactBrokerUsername": "--broker-username",
"pactBrokerPassword": "--broker-password",
"publishVerificationResult": "--publish-verification-results",
"providerVersion": "--provider-app-version"
"providerVersion": "--provider-app-version",
"customProviderHeaders": "--custom-provider-header"
};

constructor(options: VerifierOptions) {
Expand Down Expand Up @@ -152,6 +153,7 @@ export interface VerifierOptions extends SpawnArguments {
providerStatesSetupUrl?: string;
pactBrokerUsername?: string;
pactBrokerPassword?: string;
customProviderHeaders?: string[];
publishVerificationResult?: boolean;
providerVersion?: string;
pactBrokerUrl?: string;
Expand Down

0 comments on commit 3797193

Please sign in to comment.