From 10eee4632f1a2c336a1372459e79117000eca7f4 Mon Sep 17 00:00:00 2001 From: Stanley Zheng Date: Tue, 2 Feb 2016 22:39:12 -0500 Subject: [PATCH] allow surrogate characters for #26 and updating XMLbuilder to latest --- package.json | 2 +- src/middleware/negotiate-content.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b698d9d2..bc9458a5 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "qs": "^2.4.1", "redis": "^0.12.1", "require-directory": "^2.1.0", - "xmlbuilder": "^2.6.2", + "xmlbuilder": "^4.2.1", "yamljs": "^0.2.1" } } diff --git a/src/middleware/negotiate-content.js b/src/middleware/negotiate-content.js index 50f4ee8c..2013d53a 100644 --- a/src/middleware/negotiate-content.js +++ b/src/middleware/negotiate-content.js @@ -27,7 +27,7 @@ module.exports = function (req, res, next) { } function XMLResponse () { - res.send(XML.create(res.bodyXmlObj || res.body).end({ + res.send(XML.create(res.bodyXmlObj || res.body, {allowSurrogateChars: true}).end({ pretty: spaces ? true : false, indent: new Array(spaces).join(' '), newline: '\n' @@ -36,7 +36,7 @@ module.exports = function (req, res, next) { function HTMLResponse () { req.app.locals.moment = moment - + XML.create(res.bodyXmlObj, {allowSurrogateChars: true}); res.render(res.view || 'default', { req: req, res: res, @@ -46,7 +46,7 @@ module.exports = function (req, res, next) { json: JSON.stringify(res.body, null, 2), - xml: XML.create(res.bodyXmlObj || res.body).end({ + xml: XML.create(res.bodyXmlObj || res.body, {allowSurrogateChars: true}).end({ pretty: true, indent: ' ', newline: '\n'