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

Delay not working when using go_template #305

Open
netguino opened this issue Jun 12, 2024 · 0 comments
Open

Delay not working when using go_template #305

netguino opened this issue Jun 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@netguino
Copy link

Using the following mock from the documentation ( documentation example: link ) that uses lua:

- # Lua mock with body as string
  request:
    path: /test
  dynamic_response:
    engine: lua
    script: >
      return {
        body = '{"message":"request path '..request.path..'"}',
        headers = {
          ["Content-Type"] = "application/json"
        },
        delay = {
          min = "0",
          max = "10ms"
        }
      }

We can see that when hitting it, it does get delayed as expected.

If we now use the following mock example ( documentation example: link ):

- # Go Template Json mock with body as json
 request:
   path: /test6
 dynamic_response:
   engine: go_template_json
   script: >
     {
       "body": {
         "message": "request path {{.Request.Path}}"
       },
       "headers": {
         "Content-Type": ["application/json"]
       },
       "delay": {
         "min": "0",
         "max": "10ms"
       }
     }

We can now observe that it will not get delayed.

Note that using a range or a set value for the delay doesn't change the behaviour.

@Thiht Thiht added the bug Something isn't working label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants