-
-
Notifications
You must be signed in to change notification settings - Fork 237
Closed
Labels
Description
Describe the bug
This bug has been raised to address a question raised here #1410. I think have a fix but I'm currently unable to push my bugfix branch.
The HandlebarsSettings.AllowedHandlebarsHelpers configuration is ignored when trying to enable the Environment helper as documented here
https://github.com/wiremock/WireMock.Net?tab=readme-ov-file#handlebarsnet-environment-helper
Expected behavior:
When explicitly configuring AllowedHandlebarsHelpers those categories should be enabled:
e.g. this argument should enable the Environment helper
--AllowedHandlebarsHelpers Environment
Test to reproduce
This has been test in dokcer compose
- creating the service and supply the AllowedHandlebarsHelpers settings
image: sheyenrath/wiremock.net-alpine:latest
container_name: wiremock-net-test
ports:
- "8080:8080"
command:
dotnet wiremock-net.dll
--Urls http://*:8080
--ReadStaticMappings true
--WatchStaticMappings true
--WatchStaticMappingsInSubdirectories true
--WireMockLogger WireMockConsoleLogger
--AllowedHandlebarsHelpers Environment
--Port 8080
- Creating a mapping with a handlerbars transform
{
"Request": {
"Path": "/test-env",
"Methods": ["GET"]
},
"Response": {
"StatusCode": 200,
"Body": "{{Environment.GetEnvironmentVariable \"PATH\"}}",
"Headers": {
"Content-Type": "text/plain"
},
"UseTransformer": true,
"TransformerType": "Handlebars"
}
}- Call the mapping and see the error
{"Status":"Template references a helper that cannot be resolved. Helper 'Environment.GetEnvironmentVariable'"}