PactSwift
PactSwift copied to clipboard
feature: Allows custom headers for provider verification (#95)
📝 Summary of Changes
Changes proposed in this pull request:
- ProviderVerifier Options initialiser accepts
customHeaderargument. -
customHeaderis a dictionary of Strings. - Only passes key-values that contain ASCII 32-127 characters only.
- When non-allowed characters are passed they are ignored and logged into console.
- Introduces a
CharacterSet.headerASCIIAllowedcontaining only allowed characters. - Unit tests
Optionsinitialisation with allowed and non-allowed characters for header - Resolves #95
⚠️ Items of Note
Not verified with a provider.
💁 Example
let providerOptions = ProviderVerifier.Options(
provider: .init(port: 8080),
pactsSource: .directories(["/tmp/pacts"]),
customHeader: ["Foo": "Bar 123abc_", "Bar": "BAZ"]
)
🔨 How To Test
- Checkout the branch
feature/provider_verification_headers_option. - Set up a provider project and prepare
Options. - Include
customHeaderdictionary inOptions. - Run provider verification tests.
- Custom headers should be honoured.
Converted to draft due to pactffi version used in PactSwiftMockServer doesn't support this argument.
Need to get the pactffi updated, release an updated PactSwiftMockServer and only then this will work.
Watch this space.
PactSwiftMockServer v0.4.4 includes pactffi 0.3.15 that supports custom headers for non-handle based implementations.
This PR should be ready to verify it meets feature request's expectations.