go-wiremock icon indicating copy to clipboard operation
go-wiremock copied to clipboard

Add transformer parameters support in response handling

Open ssapia opened this issue 11 months ago • 0 comments

Adds Transformer Parameter Support

This PR implements the Transformer Parameter feature, as documented in the WireMock response templating guide.

The change enables dynamic parameter usage in response templates, improving flexibility for customized mock responses.

Key Benefits

  • Supports custom parameters in response templates
  • Enables finer control over dynamic responses in tests/mocks
  • Maintains compatibility with WireMock's core functionality

Usage Example

stubRule := Get(URLPathTemplate("/templated")).  
    WillReturnResponse(  
        NewResponse().  
            WithStatus(http.StatusOK).  
            WithTransformers("response-template").  
            WithTransformerParameter("MyCustomParameter", "Parameter Value"),  
    )  

ssapia avatar May 08 '25 21:05 ssapia