Adding Authorization header to every request

Issue #50 closed
Shashi D created an issue

We have this authorization token in the pact build gradle file. which is used for pactVerify step in provider pact using the pact library.

pact {

    serviceProviders {
        testprovider {
            protocol ='http'
            host = 'api'
            port = 80
            requestFilter = { req ->
                // Add an authorization header to each request
                req.addHeader('Authorization', AUTH_TOKEN)
            }
            hasPactWith("testconsumer") {
                pactFile = file("../pacts/testconsumer-testprovider.json")
            }
        }
    }
}

So we need similar requestFilter so that every request during the verification uses an AUTH_TOKEN

Is that already possible? could you please point me to an example where that can be done.

Comments (2)

  1. Log in to comment