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
Fix custom response templating #2350
Fix custom response templating #2350
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks about right. If you could create a test case for this regression, it would be awesome
Please could you run |
adcf920
to
3f9268b
Compare
@tomakehurst done |
3f9268b
to
c4e7163
Compare
@oleg-nenashev I have added a simple test that would fail without the PR. |
Not a necessary fix per #2349 (comment). Documentation will be updated soon to reflect the new, simplified way to enable templating. |
@tomakehurst so it would be a new documented breaking change, right? |
Yes, will add to the release note and update the main doc in due course. |
@tomakehurst can you please re-evaluate. As an end user I find it a really hard to use behaviour. globalTemplating /global is one thing. But I need to have to customize the templateEngine, which I then need to put in the ResponseTemplateTransformer. WireMockConfiguration config = new WireMockConfiguration();
FileSource fs = new ClasspathFileSource("src/test/resources/mocks/");
TemplateEngine engine = new TemplateEngine(Map.of("json", Jackson2Helper.INSTANCE), null, null, true);
config = config.port(9094).fileSource(fs)
.extensions(new ResponseTemplateTransformer(engine, true, fs, Collections.emptyList()));
wireMockServer = new WireMockServer(config);
wireMockServer.start(); Why if I make the effort of specifying the |
Again, I think the docs need improving here - if you want to add custom helpers you do it via another extension point now: It shouldn't ever be necessary as an end user to new up your own |
OK, I can confirm all this is working as you said right above. Thanks for that, I totally missed that doc page. I think this should be noted in the migration steps of the release page. Since before we had to create the |
References
fixes #2349
when manually creating a
ResponseTemplateTransformer
viaWireMockConfiguration.extentions
. It gets added to the loadedExtensions, but then gets overwritten by the put.Submitter checklist
#help-contributing
or a project-specific channel like#wiremock-java