From 0ae1ec4960696c94e849e4fe212c9631f382af87 Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Mon, 14 Dec 2020 11:31:19 +0800 Subject: [PATCH] docs: uniCloud function http --- docs/uniCloud/http.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/uniCloud/http.md b/docs/uniCloud/http.md index e1c0411ec6..535a704213 100644 --- a/docs/uniCloud/http.md +++ b/docs/uniCloud/http.md @@ -308,3 +308,22 @@ content-length: 9897 ``` + +##### 返回不同的状态码 + +如需重定向或返回4xx,5xx等自定义状态码等,可以使用如下方式 + +**注意:阿里云暂不支持在返回的header里面使用location** + +```js +exports.main = function() { + return { + mpserverlessComposedResponse: false, // 使用阿里云返回集成响应是需要此字段为true + isBase64Encoded: false, + statusCode: 301, + headers: { + 'location': 'http://www.baidu.com' + } + } +} +``` \ No newline at end of file -- GitLab