-
Notifications
You must be signed in to change notification settings - Fork 208
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
templating using Request.Body jsonpath will replace characters with HTML character encodings #963
Comments
We use this library for templating: https://github.com/aymerick/raymond According to the doc, if you need to unescaped value, you can triple the mustache if you try this, it should work: |
Thank you @tommysitu for the solution. Triple moustache it is. I have attached With that said, Hoverfly does needs address the issues with escaping JSON when Consider the file
The When the Hoverfly simulates the POST response, malformed JSON is returned:
Data returned is:
The double quote characters within the hoverfly-templating-example-triple-moustache.zip |
Description of the bug
When templating is enabled for JSON request/response, if the request body is:
{ "name": "O'Reilly" }
And the response body is set to:
{ "name": "{{ Request.Body 'jsonpath' '$.name' }}"
The Hoverfly will return:
{ "name": "O@apos;Reilly" }
Steps to reproduce the issue
Import attached Hoverfly simulation file hoverfly-templating-example.json, and set Hoverfly to simulate.
Templated POST response is:
Execute the non-proxied POST:
post-data.json
contains the following:Which will return:
Execute the proxied POST:
Which will return:
The
address.street
andcompany.name
values contain@apos;
instead of'
(single quote).Observed result
{{ Request.Body 'jsonpath' '$.address.street' }}
returns3027 O'hara Lane
{{ Request.Body 'jsonpath' '$.company.name' }}
returnsO'connell-Tillman
Expected result
{{ Request.Body 'jsonpath' '$.address.street' }}
returns3027 O'hara Lane
{{ Request.Body 'jsonpath' '$.company.name' }}
returnsO'connell-Tillman
Attached files.zip contains:
files.zip
The text was updated successfully, but these errors were encountered: