Skip to content
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

Add json escape option #3506

Merged
merged 8 commits into from
Aug 5, 2017
Merged

Conversation

g-k
Copy link
Contributor

@g-k g-k commented May 31, 2017

refs: hapijs/hoek#204

Adds the json.escape option to call hoek.escapeJSON on the JSON output. It's disabled by default.

There's probably a better place and name for this option.

API.md Outdated
- `replacer` - the replacer function or array. Defaults to no action.
- `space` - number of spaces to indent nested object keys. Defaults to no indentation.
- `suffix` - string suffix added after conversion to JSON string. Defaults to no suffix.
- `escape` - calls [`Hoek.jsonEscape`](https://github.com/hapijs/hoek/blob/master/API.md#escapejsonstring) after conversion to JSON string. Defaults to not escaping.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would go with "defaults to false."

package.json Outdated
@@ -26,7 +26,7 @@
"catbox-memory": "2.x.x",
"cryptiles": "3.x.x",
"heavy": "4.x.x",
"hoek": "4.x.x",
"hoek": "git+https://git@github.com/hapijs/hoek.git",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a legit version, maybe ask @nlf to do a release of hoek?

@@ -800,6 +800,26 @@ describe('Response', () => {
});
});

describe('escape()', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test with a success case as well for .escape()

@AdriVanHoudt
Copy link
Contributor

Also CI is failing since, I think, hapi uses a shrinkwrap that causes it to install hoek@4 and not the latest version you told it to in the package.json. A new version of hoek would solve this.

@AdriVanHoudt AdriVanHoudt added the feature New functionality or improvement label Jun 1, 2017
@hueniverse
Copy link
Contributor

@g-k you still have some open comments above (beside the missing hoek version).

@hueniverse hueniverse self-assigned this Aug 5, 2017
@hueniverse hueniverse added this to the 16.5.3 milestone Aug 5, 2017
@hueniverse hueniverse merged commit 8d1e4e6 into hapijs:master Aug 5, 2017
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants