<legend id='DYrpa'><style id='DYrpa'><dir id='DYrpa'><q id='DYrpa'></q></dir></style></legend>
      <bdo id='DYrpa'></bdo><ul id='DYrpa'></ul>

    <i id='DYrpa'><tr id='DYrpa'><dt id='DYrpa'><q id='DYrpa'><span id='DYrpa'><b id='DYrpa'><form id='DYrpa'><ins id='DYrpa'></ins><ul id='DYrpa'></ul><sub id='DYrpa'></sub></form><legend id='DYrpa'></legend><bdo id='DYrpa'><pre id='DYrpa'><center id='DYrpa'></center></pre></bdo></b><th id='DYrpa'></th></span></q></dt></tr></i><div id='DYrpa'><tfoot id='DYrpa'></tfoot><dl id='DYrpa'><fieldset id='DYrpa'></fieldset></dl></div>
    <tfoot id='DYrpa'></tfoot>

      1. <small id='DYrpa'></small><noframes id='DYrpa'>

        Azure Functions 重定向标头

        Azure Functions Redirect Header(Azure Functions 重定向标头)

              <bdo id='KjJu7'></bdo><ul id='KjJu7'></ul>
                <tbody id='KjJu7'></tbody>

                <legend id='KjJu7'><style id='KjJu7'><dir id='KjJu7'><q id='KjJu7'></q></dir></style></legend>

                <small id='KjJu7'></small><noframes id='KjJu7'>

              1. <i id='KjJu7'><tr id='KjJu7'><dt id='KjJu7'><q id='KjJu7'><span id='KjJu7'><b id='KjJu7'><form id='KjJu7'><ins id='KjJu7'></ins><ul id='KjJu7'></ul><sub id='KjJu7'></sub></form><legend id='KjJu7'></legend><bdo id='KjJu7'><pre id='KjJu7'><center id='KjJu7'></center></pre></bdo></b><th id='KjJu7'></th></span></q></dt></tr></i><div id='KjJu7'><tfoot id='KjJu7'></tfoot><dl id='KjJu7'><fieldset id='KjJu7'></fieldset></dl></div>
                <tfoot id='KjJu7'></tfoot>

                  本文介绍了Azure Functions 重定向标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我希望我的一个 Azure Functions 执行 HTTP 重定向.

                  I want one of my Azure Functions to do an HTTP Redirection.

                  这是函数的当前代码:

                  module.exports = context => {
                    context.res.status(302)
                    context.res.header('Location', 'https://www.stackoverflow.com')
                    context.done()
                  }
                  

                  但它不起作用.

                  从 Postman 发送的请求显示响应有:

                  A request sent from Postman shows the response has:

                  • 状态:200
                  • 位置未设置
                  • Status: 200
                  • Location not set

                  这是正确的代码吗?还是 Azure Functions 根本不允许?

                  Is this correct code? Or is it simply not allowed by Azure Functions?

                  推荐答案

                  上面的代码确实有效,除非您将绑定名称设置为 $return,这就是我假设您现在拥有的(您可以在集成标签)

                  The code above actually does work, unless you have your binding name set to $return, which is what I assume you have now (you can check in the integrate tab)

                  以下任一选项也可以满足您的需求

                  Either of the following options will also do what you're looking for

                  假设 $return 在绑定配置中:

                  Assuming $return in the binding configuration:

                  module.exports = function (context, req) {
                  var res = { status: 302, headers: { "location": "https://www.stackoverflow.com" }, body: null};
                  context.done(null, res);
                  };
                  

                  或者使用express style"API(在绑定配置中不使用$return):

                  Or using the "express style" API (not using $return in the binding configuration):

                  module.exports = function (context, req) {
                  context.res.status(302)
                              .set('location','https://www.stackoverflow.com')
                              .send();
                  };
                  

                  这篇关于Azure Functions 重定向标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  quot;Status Code:200 OK (from ServiceWorker)quot; in Chrome Network DevTools?(“状态码:200 OK(来自 ServiceWorker)在 Chrome 网络开发工具中?)
                  How to set a header for a HTTP GET request, and trigger file download?(如何为 HTTP GET 请求设置标头并触发文件下载?)
                  Adding custom HTTP headers using JavaScript(使用 JavaScript 添加自定义 HTTP 标头)
                  SQL Query DocumentDB in Azure Functions by an integer not working(通过整数在 Azure Functions 中 SQL 查询 DocumentDB 不起作用)
                  Azure Functions [JavaScript / Node.js] - HTTP call, good practices(Azure Functions [JavaScript/Node.js] - HTTP 调用,良好实践)
                  Azure Functions - Import Custom Node Module(Azure Functions - 导入自定义节点模块)
                • <i id='u7nlj'><tr id='u7nlj'><dt id='u7nlj'><q id='u7nlj'><span id='u7nlj'><b id='u7nlj'><form id='u7nlj'><ins id='u7nlj'></ins><ul id='u7nlj'></ul><sub id='u7nlj'></sub></form><legend id='u7nlj'></legend><bdo id='u7nlj'><pre id='u7nlj'><center id='u7nlj'></center></pre></bdo></b><th id='u7nlj'></th></span></q></dt></tr></i><div id='u7nlj'><tfoot id='u7nlj'></tfoot><dl id='u7nlj'><fieldset id='u7nlj'></fieldset></dl></div>

                    <small id='u7nlj'></small><noframes id='u7nlj'>

                    <legend id='u7nlj'><style id='u7nlj'><dir id='u7nlj'><q id='u7nlj'></q></dir></style></legend>
                        <tbody id='u7nlj'></tbody>

                    • <tfoot id='u7nlj'></tfoot>

                          • <bdo id='u7nlj'></bdo><ul id='u7nlj'></ul>