【发布时间】:2016-11-10 22:44:41
【问题描述】:
寻找从 Azure 函数返回 XML 的 Node.js 示例。我下面的代码返回 xml 字符串,但响应 Content-Type 设置为 text/plain; charset=utf-8 而不是 text/xml; charset=utf-8
index.js
module.exports = function(context, req) {
var xml = '<?xml version="1.0" encoding="UTF-8"?><Response><Say>Azure functions!</Say></Response>';
context.res = {
contentType: 'text/xml',
body: xml
};
context.done();
};
这里是绑定。
function.json
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req"
},
{
"type": "http",
"direction": "out",
"name": "res"
}
],
"disabled": false
}
【问题讨论】:
标签: xml azure twilio azure-functions