SpectoLabs / hoverfly-java

Java binding for Hoverfly
Apache License 2.0
168 stars 58 forks source link

Cannot use Request Templating with hovefly-java 0.11.0 #189

Closed ErikHammarberg closed 6 years ago

ErikHammarberg commented 6 years ago

I'm trying the following to extract an id from the request to use in the response: `@ClassRule public static HoverflyRule hoverflyRule = HoverflyRule.inSimulationMode(dsl( service("my-site") .post("/path/to/service").body(HoverflyMatchers.any()) .willReturn(success().body( HttpBodyConverter.jsonWithSingleQuotes( "{'validatedOrderItems' : '{{ Request.Body 'jsonpath' '$.callingSystem' }}'}" )))

), HoverflyConfig.localConfigs().proxyPort(PROXY_PORT).adminPort(ADMIN_PORT));`

However, all I seem to get as a return-value is an empty string. Same seem to apply if I try to use Request.Method or most other options specified here: . The options that seem to work for me is Request.Path, which gives me the path with stripped </>.

Are there plans for a java-release with Request.Body templating support in the near future?

tommysitu commented 6 years ago

Hi @ErikHammarberg, the work has been done, but not released yet. Feel free to use SNAPSHOT version (0.11.1-SNAPSHOT) for now.

tommysitu commented 6 years ago

fixed in version 0.11.1