Skip to content

setVar doesn't work within #each #793

@jtaylordigital

Description

@jtaylordigital

Describe the bug
Mockoon is generating an error when using setVar within an #each block. This behavior appears to be similar to #429.
Example error message: Error while serving the content: Cannot create property 'testVar' on string '1'

To Reproduce
This is a sample Response Body that results in this error. This Response will work if setVar is removed.

{
  {{#each (split '1 2 3')}}
  {{setVar 'testVar' '4'}}
    "test": {{this}}
  {{/each}}
}

Mockoon version:
1.20.0

OS / OS version:
Windows 10

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

✅ Done (ready for next release)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions