Open StefH opened 2 years ago
Hello @sethsouthern.
WireMock.Net uses HandlebarsDotNet.Helpers.JsonPathHelpers to handle JsonPath. This project is located here: https://github.com/Handlebars-Net/Handlebars.Net.Helpers
I did move the issue.
And can you please create a failing unit test ? I want to check if this is an issue in JsonPath, JsonPathHelpers or Handlebars.Net
@sethsouthern did you have time to create a unit test?
Describe the bug
When using the JsonPath.SelectToken feature in the handlebar transformer, I get a null ref exception. The exception occurs in HandlebarsDotNet.Helpers.JsonPathHelpers.SelectToken(object, string). Decompiling shows that the value of the string parameter is
"name\"
including the backslash. If I remove the backslash then everything works but the backslash is just the escape character for the double-quote. if this is the good old ID10T or pebcak issue, then please close. My guess is it's an off-by-one in some string parsing.Expected behavior:
Handlebar transformation should function as described in example at https://github.com/WireMock-Net/WireMock.Net/wiki/Response-Templating#jsonpath.
Test to reproduce
ParseAsJToken(value, "SelectToken").SelectToken("name")
- evaluates correctlyParseAsJToken(value, "SelectToken").SelectToken("name\")
- evaluates to nullOther related info
Unit Test Class
response.json