surpher / surpher/PactSwift

Feature Request: Add Ability to Pass Custom Header for Verification

Open
#95 14 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Swift
Stars
56
Forks
21
PR merge metrics
No merged PRs in 30d

Description

🗣 Context

Would like to ProviderVerifier.Options to support --header <custom-header> option

💬 Narrative

When I run my PactVerifiable conforming tests
I want to be able to pass in a header option
So that I can inject the header with an authorization token

📝 Notes

According to the pact_verifier_cli documentation , passing a custom header is one of the available options.

--header <custom-header>...
            Add a custom header to be included in the calls to the provider. Values must be in the
            form KEY=VALUE, where KEY and VALUE contain ASCII characters (32-127) only. Can be
            repeated.

🏗 Design

✅ Acceptance Criteria

GIVEN header = ["Authorization" : "sometokenhere"

WHEN
ProviderVerifier.Options is initialized with custom header value

options = ProviderVerifier.Options(
            provider: provider,
            pactsSource: .broker(pactBroker),
            customHeader: header,
            logLevel: .error
        )

THEN
Provider Verification is successful and custom header to pact_verifier_cli is passed in the option list.

🚫 Out of Scope

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing ProviderVerifier.Options and how its values are turned into pact_verifier_cli arguments. Check the existing PactVerifiable provider-verification flow and confirm how options are passed to the CLI. Done means a custom header can be supplied through ProviderVerifier.Options and is included in successful provider verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.