quarkiverse / quarkus-wiremock

Quarkus extension for launching an in-process Wiremock server
https://wiremock.org/
Apache License 2.0
16 stars 12 forks source link

Error 500 when using Wiremock response templates #181

Closed MikaelAnderssonWigander closed 2 weeks ago

MikaelAnderssonWigander commented 2 weeks ago

Hi

I'm using the latest of Quarkus and Wiremock Dev service and like to use response templates in Wiremock. According to the documentation in Quarkiverse the feature is disabled but when I enable it I still get errors from Wiremock.

I don't really know what to do or what I'm doing wrong but my other mappings is working (not templates).

Here is the mappings json:

{
  "request": {
    "method": "GET",
    "url": "/your-endpoint"
  },
  "response": {
    "status": 200,
    "body": "{{#if (randomBoolean)}}Hello{{else}}Goodbye{{/if}}",
    "transformers": ["response-template"]
  }
}

I get an Error 500 back from Wiremock:

<title>Error 500 wiremock.com.google.common.util.concurrent.UncheckedExecutionException: wiremock.com.github.jknack.handlebars.HandlebarsException: inline@5613d36d:1:7: could not find helper: &apos;randomBoolean&apos;
{{#if (randomBoolean)}}[
       ^
</title>
</head>
<body><h2>HTTP ERROR 500 wiremock.com.google.common.util.concurrent.UncheckedExecutionException: wiremock.com.github.jknack.handlebars.HandlebarsException: inline@5613d36d:1:7: could not find helper: &apos;randomBoolean&apos;
{{#if (randomBoolean)}}[
       ^
</h2>

In my yaml file I have set the properties:

quarkus:
    wiremock:
      devservices:
        global-response-templating: true
        extension-scanning-enabled: true

Any clues?

Thx

M

MikaelAnderssonWigander commented 2 weeks ago

cloud only