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

Adding HttpRequest header in MockMvcTestTarget causing error: No ParameterResolver registered for parameter *** #1334

Closed
cayyappu opened this issue Mar 27, 2021 · 3 comments

Comments

@cayyappu
Copy link

When trying to add request header

 @TestTemplate
    @ExtendWith(PactVerificationInvocationContextProvider::class)
    fun pactVerificationTestTemplate(context: PactVerificationContext, request: HttpRequest){
        request.addHeader("Cookie", generateCookieString())
        
        context.verifyInteraction()
    }
No ParameterResolver registered for parameter [org.apache.http.HttpRequest request] in method ***

Reference code & Project: https://github.com/Dev-Experiment/pact-cookiebug-demo/blob/master/src/test/kotlin/com/appu/springrest/pact/GreetingProviderPactSpringJunit5MockMVCTest.kt

@cayyappu cayyappu changed the title Adding HttpRequest header in mockmvctarget causing error: No ParameterResolver registered for parameter Adding HttpRequest header in MockMvcTestTarget causing error: No ParameterResolver registered for parameter *** Mar 27, 2021
uglyog pushed a commit that referenced this issue Mar 28, 2021
@uglyog
Copy link
Member

uglyog commented Mar 28, 2021

When using the MockMvcTestTarget, the request parameter will be a MockHttpServletRequestBuilder not a HttpRequest

@uglyog
Copy link
Member

uglyog commented Mar 28, 2021

4.1.19 released

@cayyappu
Copy link
Author

Thanks for the quick fix. It works now. Just that One has to ExtendWith PactVerificationSpringProvider in the TestTemplate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants