diff --git a/README.md b/README.md index 6b4ce2f72..f8866733b 100644 --- a/README.md +++ b/README.md @@ -299,6 +299,8 @@ new Verifier().verifyProvider(opts).then(function () { | `timeout` | false | number | The duration in ms we should wait to confirm verification process was successful. Defaults to 30000. | | `requestFilter` | false | object | An Express middleware handler (See https://expressjs.com/en/guide/writing-middleware.html) to modify requests and responses from the provider. See below for more details. | | `stateHandlers` | false | object | Provider state handlers. A map of `string` -> `() => Promise`, where each string is the state to setup, and the function is used to configure the state in the Provider. See below for detail. | +| `validateSSL` | false | boolean | Allow self-signed certificates. Defaults to true, if not set. | +| `changeOrigin` | false | boolean | Changes the origin of the host header to the target URL. Defaults to false, if not set. | @@ -341,7 +343,7 @@ Sometimes you may need to add things to the requests that can't be persisted in For these cases, we have two facilities that should be carefully used during verification: 1. the ability to specify custom headers to be sent during provider verification. The flag to achieve this is `customProviderHeaders`. -1. the ability to modify a request/response and modify the payload. The flag to achieve this is `requestFilter`. +2. the ability to modify a request/response and modify the payload. The flag to achieve this is `requestFilter`. **Example API with Authorization** diff --git a/src/dsl/verifier.ts b/src/dsl/verifier.ts index eff411e53..1eccb5968 100644 --- a/src/dsl/verifier.ts +++ b/src/dsl/verifier.ts @@ -48,6 +48,7 @@ export interface VerifierOptions { format?: "json" | "RspecJunitFormatter" out?: string validateSSL?: boolean + changeOrigin?: boolean } export class Verifier { @@ -156,6 +157,7 @@ export class Verifier { app.all("/*", (req, res) => { logger.debug("Proxing", req.path) proxy.web(req, res, { + changeOrigin: this.config.changeOrigin === false, secure: this.config.validateSSL === true, target: this.config.providerBaseUrl, }) @@ -209,6 +211,9 @@ export class Verifier { if (this.config.validateSSL === undefined) { this.config.validateSSL = true } + if (this.config.changeOrigin === undefined) { + this.config.changeOrigin = false + } if (this.config.logLevel && !isEmpty(this.config.logLevel)) { serviceFactory.logLevel(this.config.logLevel)