-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Type conversion when using bodyAsJson #709
Comments
Hello @V1le thank you for this issue. (Note that I first thought that this could be related to Handlebars: https://dotnetfiddle.net/b3WCwx, but I think that's ok.) |
Try preview version (https:/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions) |
@StefH
Well, bug is fixed, but I think would be good if these 3 cases would pass. |
@V1le However, I need to revert this fix because it's not correct. The problem is that when The only way to make sure that a string stays a string, is adding two extra quotes, like this: "BodyAsJson": {
"text": "\"{{request.bodyAsJson.text}}\""
}, When this is done, all options return a string, so:
There is no other/easy way without breaking the current logic from WireMock. |
Thank you for providing workaround - did not think about adding extra quotes. |
Closing this question. |
I see that Scriban does have the method See this example: However, currently I'm using the So in order to get this working, I need to add a new setting which can switch between Evaluate or Render and then you need to choose Scriban instead of Handlebars. Maybe this could work, however I'll not build this in a short time... |
Description:
Wiremock changes data types in response fields.
For example:
I have following response template:
If I am making request with field that containts text then wiremock send my text back as string type as it should be:
"text": "abc"
- >"text": "abc"
but if I am making request with field that contains string but it is a number then wiremock responses with the Int type:
"text": "1"
->"text": 1
Expected behavior:
Wiremock does not change data types in response fields.
Test to reproduce
"test": "1"
)"test": 1
Other related info
Wiremock version - 1.4.30
The text was updated successfully, but these errors were encountered: