Skip to content

Commit

Permalink
chore: synced pact-php docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Github Action committed Sep 4, 2024
1 parent 7a9e818 commit 03e7d48
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions website/docs/implementation_guides/php/docs/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ public function testPactVerifyConsumers(): void
}
```

## Add Custom Headers Prior to Verification

Sometimes you may need to add custom headers to the requests that can't be persisted in a pact file.
e.g. an OAuth bearer token: `Authorization: Bearer 1a2b3c4d5e6f7g8h9i0k`

```php
$config->getCustomHeaders()
->addHeader('Authorization', 'Bearer 1a2b3c4d5e6f7g8h9i0k');
```

The requests will have custom headers added before being sent to the Provider API.

> Note: Custom headers are not the only approach for authentication and authorization. For other approaches, please refer to this [documentation](https://docs.pact.io/provider/handling_auth#4-modify-the-request-to-use-real-credentials).
> **Important Note:** You should only use this feature for headers that can not be persisted in the pact file. By modifying the request, you are potentially modifying the contract from the consumer tests!
## Verification Sources

There are four ways to verify Pact files. See the examples below.
Expand Down
1 change: 1 addition & 0 deletions website/docs/implementation_guides/php/upgrade-10.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ This migrates from a CLI driven process for the Pact Framework, to an FFI proces
- `addUrl` - Verify Provider by Pact Url retrieved by Broker (Webhooks)
- `addBroker` Verify Provider by dynamically fetched Pacts (Provider change)
- `addFile` / `addDir` - Verify Provider by local file or directory
- `$config->addCustomProviderHeader("headerName", "headerValue")` is now available via `$config->getCustomHeaders()->addHeader("headerName", "headerValue")`
Example Usage:
Expand Down

0 comments on commit 03e7d48

Please sign in to comment.