-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
[Question] Dates in response templates #568
Comments
Hello @Narcalen This is not yet supported in WireMock.Net but this could be added to Handlebars.Net.Helpers I will take a look if it can be added there. |
I'm looking at the code from Handlebars.Net/Helpers and in this case, the string to use would be like: "{{Format (Now) \"yyyy-MM-dd\"}}" Would be work for you? |
Or another possible solution will be: "{{Now \"yyyy-MM-dd\"}}" |
Thank you for the response! I have tried the second option and I am getting the following response: Template references a helper that is not registered. Could not find helper 'Now' Is it possible to register additional handlebar helpers? |
Sorry for the confusion I caused. This new functionality is now present in Handlebars.Net.Helpers however not yet used by WireMock.Net I'm working in that and I keep you informed. |
@Narcalen Please try preview version |
@StefH For both options, I received the following error: Moreover, I have received the same errors for other helpers, e.g.: Could you please suggest if I am missing anything? |
Can you share your example project? |
https://github.com/Narcalen/example-wiremock-net This mapping works fine with version 1.4.3 and returns |
This should work: "{{Random Type=\"Integer\" Min=100 Max=999999}} {{DateTime.Now}} {{DateTime.Now \"yyyy-MMM\"}} {{String.Format (DateTime.Now) \"MMM-dd\"}}" Use exact version 1.4.3-ci-14635 |
@StefH this version works fine for me. Thanks! |
great! You can expect a new 1.4.4 in some time |
Is it possible to add formatted dates to response templates? e.g. I would like to do smth like this:
Where now is current datetime, not data extracted from request
The text was updated successfully, but these errors were encountered: