How I can register my own Handlebars Helper #459

Closed
opened 2025-12-29 15:24:19 +01:00 by adam · 1 comment
Owner

Originally created by @THenryT on GitHub (Oct 17, 2022).

Originally assigned to: @StefH on GitHub.

I am trying to create a dynamic JWT token in response. I know Wiremock.NET does not support it, and if it is possible to that I can create a handlebars helper to generate a jwt token for example {{Jwt iss="localhost:9001"}} and then the response will return a jwt token?

Originally created by @THenryT on GitHub (Oct 17, 2022). Originally assigned to: @StefH on GitHub. I am trying to create a dynamic JWT token in response. I know Wiremock.NET does not support it, and if it is possible to that I can create a handlebars helper to generate a jwt token for example {{Jwt iss="localhost:9001"}} and then the response will return a jwt token?
adam added the question label 2025-12-29 15:24:19 +01:00
adam closed this issue 2025-12-29 15:24:19 +01:00
Author
Owner

@StefH commented on GitHub (Oct 17, 2022):

@THenryT
This is indeed possible, you can call your handlebars registration code in the WireMockServerSettings : HandlebarsRegistrationCallback.

Example:

var server = WireMockServer.Start(new WireMockServerSettings
{
	
	HandlebarsRegistrationCallback = (handlebarsContext, fileSystemHandler) =>
	{
		// var transformer = new CustomNameTransformer();
		// handlebarsContext.RegisterHelper(transformer.Name, transformer.Render); TODO
	}
});
@StefH commented on GitHub (Oct 17, 2022): @THenryT This is indeed possible, you can call your handlebars registration code in the **WireMockServerSettings** : **HandlebarsRegistrationCallback**. Example: ``` c# var server = WireMockServer.Start(new WireMockServerSettings { HandlebarsRegistrationCallback = (handlebarsContext, fileSystemHandler) => { // var transformer = new CustomNameTransformer(); // handlebarsContext.RegisterHelper(transformer.Name, transformer.Render); TODO } }); ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#459