Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Allows custom headers for provider verification (#95) #96

Closed
wants to merge 4 commits into from

Conversation

surpher
Copy link
Owner

@surpher surpher commented Oct 1, 2022

📝 Summary of Changes

Changes proposed in this pull request:

  • ProviderVerifier Options initialiser accepts customHeader argument.
  • customHeader is 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.headerASCIIAllowed containing only allowed characters.
  • Unit tests Options initialisation with allowed and non-allowed characters for header
  • Resolves Feature Request: Add Ability to Pass Custom Header for Verification #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

  1. Checkout the branch feature/provider_verification_headers_option.
  2. Set up a provider project and prepare Options.
  3. Include customHeader dictionary in Options.
  4. Run provider verification tests.
  5. Custom headers should be honoured.

@surpher surpher added the enhancement New feature or request label Oct 1, 2022
@surpher surpher marked this pull request as draft October 7, 2022 07:29
@surpher
Copy link
Owner Author

surpher commented Oct 7, 2022

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.

@surpher surpher self-assigned this Oct 7, 2022
v0.4.4 contains pact_ffi 0.3.15 which includes 2e5823a - feat: add custom-header to the old FFI args for implementations that have not moved to handles
@surpher surpher force-pushed the feature/provider_verification_headers_option branch from 12e700a to 2a03f6b Compare November 28, 2022 09:40
@surpher surpher marked this pull request as ready for review November 28, 2022 13:00
@surpher
Copy link
Owner Author

surpher commented Nov 28, 2022

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.

@surpher surpher force-pushed the main branch 18 times, most recently from 15f7c5a to 98716cd Compare August 5, 2023 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Add Ability to Pass Custom Header for Verification
1 participant