Skip to content

Commit 03e7d48

Browse files
author
Github Action
committed
chore: synced pact-php docs
1 parent 7a9e818 commit 03e7d48

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

website/docs/implementation_guides/php/docs/provider.md

+16
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ public function testPactVerifyConsumers(): void
6464
}
6565
```
6666

67+
## Add Custom Headers Prior to Verification
68+
69+
Sometimes you may need to add custom headers to the requests that can't be persisted in a pact file.
70+
e.g. an OAuth bearer token: `Authorization: Bearer 1a2b3c4d5e6f7g8h9i0k`
71+
72+
```php
73+
$config->getCustomHeaders()
74+
->addHeader('Authorization', 'Bearer 1a2b3c4d5e6f7g8h9i0k');
75+
```
76+
77+
The requests will have custom headers added before being sent to the Provider API.
78+
79+
> 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).
80+
81+
> **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!
82+
6783
## Verification Sources
6884

6985
There are four ways to verify Pact files. See the examples below.

website/docs/implementation_guides/php/upgrade-10.0.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ This migrates from a CLI driven process for the Pact Framework, to an FFI proces
4949
- `addUrl` - Verify Provider by Pact Url retrieved by Broker (Webhooks)
5050
- `addBroker` Verify Provider by dynamically fetched Pacts (Provider change)
5151
- `addFile` / `addDir` - Verify Provider by local file or directory
52+
- `$config->addCustomProviderHeader("headerName", "headerValue")` is now available via `$config->getCustomHeaders()->addHeader("headerName", "headerValue")`
5253

5354
Example Usage:
5455

0 commit comments

Comments
 (0)