strong-error-handler/lib/send-xml.js

15 lines
455 B
JavaScript
Raw Normal View History

2019-05-09 12:51:57 +00:00
// Copyright IBM Corp. 2017. All Rights Reserved.
2017-01-09 16:01:52 +00:00
// Node module: strong-error-handler
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
'use strict';
const js2xmlparser = require('js2xmlparser');
2017-01-09 16:01:52 +00:00
module.exports = function sendXml(res, data) {
const content = js2xmlparser.parse('error', data);
2017-01-09 16:01:52 +00:00
res.setHeader('Content-Type', 'text/xml; charset=utf-8');
res.end(content, 'utf-8');
};