Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
1556a19a
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
720
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1556a19a
编写于
3月 24, 2020
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update cf-functions.md
上级
2a0f6574
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
40 addition
and
12 deletion
+40
-12
docs/uniCloud/cf-functions.md
docs/uniCloud/cf-functions.md
+40
-12
未找到文件。
docs/uniCloud/cf-functions.md
浏览文件 @
1556a19a
...
...
@@ -42,18 +42,46 @@ exports.main = async (event, context) => {
**requestOptions参数说明**
|参数名 |类型 |是否必填 |默认值 |说明 |
|---- |---- |---- |---- |---- |
|method |String | - |GET |HTTP 请求方法, 默认为:GET. 可选值: GET, POST, DELETE, PUT |
|data |Object | - |- |发送的数据 |
|dataAsQueryString|Boolean | - |true |是否强制转换data为queryString |
|content |String
|
Buffer | - |- |手动设置请求的payload,设置后会忽略data |
|files |Array
<
ReadStream
|
Buffer
|
String
>
|
Object
|
ReadStream
|
Buffer
|
String| - |- |上传的文件,设置后将会使用 multipart/form-data 格式。如果未设置method,将会自动将method设置为POST |
|contentType |String | - |- |上传数据的格式,设为
`json`
会自动在
`header`
内设置
`Content-Type: application/json`
|
|nestedQuerystring|Boolean | - |- |转换data为queryString时默认不支持嵌套Object,此选项设置为true则支持转换嵌套Object |
|dataType |String | - |- |返回的数据格式,可选值为 'json'(返回数据转为JSON),'text'(返回数据转为字符串), ''(返回数据不做处理,默认值) |
|headers |Object | - |- |请求头 |
|timeout |Number
|
Array | - |- |超时时间设置。设置为数组时第一项为请求超时,第二项为返回超时。设置为数字时相当于同时设置请求超时和返回超时,即
`timeout:3000`
效果等于
`timeouut:[3000,3000]`
|
|参数名 |类型 |是否必填 |默认值 |说明 |
|---- |---- |---- |---- |---- |
|method |String | - |GET |HTTP 请求方法, 默认为:GET. 可选值: GET, POST, DELETE, PUT |
|data |Object | - |- |发送的数据 |
|dataAsQueryString |Boolean | - |true |是否强制转换data为queryString |
|content |String
|
Buffer | - |- |手动设置请求的payload,设置后会忽略data |
|stream |ReadStream |- |- |发送请求正文的可读数据流 |
|writeStream |WriteStream |- |- |接受响应数据的可写数据流 |
|consumeWriteStream |Boolean |- |true |是否等待 writeStream 完全写完才算响应全部接收完毕 |
|files |Array
<
ReadStream
|
Buffer
|
String
>
|
Object
|
ReadStream
|
Buffer
|
String| - |- |上传的文件,设置后将会使用 multipart/form-data 格式。如果未设置method,将会自动将method设置为POST |
|contentType |String | - |- |上传数据的格式,设为
`json`
会自动在
`header`
内设置
`Content-Type: application/json`
|
|nestedQuerystring |Boolean | - |- |转换data为queryString时默认不支持嵌套Object,此选项设置为true则支持转换嵌套Object |
|dataType |String | - |- |返回的数据格式,可选值为 'json'(返回数据转为JSON),'text'(返回数据转为字符串), ''(返回数据不做处理,默认值) |
|fixJSONCtlChars |Boolean |- |false |在JSON.parse之前处理响应结果中的控制字符(Control Character) |
|headers |Object | - |- |请求头 |
|timeout |Number
|
Array | - |- |超时时间设置。设置为数组时第一项为请求超时,第二项为返回超时。设置为数字时相当于同时设置请求超时和返回超时,即
`timeout:3000`
效果等于
`timeouut:[3000,3000]`
|
|auth |String |- |- |简单登录授权(Basic Authentication)参数,必须按照
`user:password`
格式设置 |
|digestAuth |String |- |- |摘要登录授权(Digest Authentication)参数,必须按照
`user:password`
格式设置 |
|agent |
[
http.Agent
](
https://nodejs.org/api/http.html#http_class_http_agent
)
|- |- |http代理,如不使用可设为false |
|httpsAgent |
[
https.Agent
](
https://nodejs.org/api/https.html#https_class_https_agent
)
|- |- |https代理,如不使用可设为false |
|ca |String
|
Buffer
|
Array |- |- |证书内容 |
|rejectUnauthorized |Boolean |- |true |是否在证书不受信任时返回错误 |
|pfx |String
|
Buffer |- |- |包含了私钥, 证书和CA certs, 一般是 PFX 或者 PKCS12 格式 |
|key |String
|
Buffer |- |- |PEF格式的服务器的私钥 |
|cert |String
|
Buffer |- |- |PEM格式的服务器证书密钥 |
|passphrase |String |- |- |私钥或pfx密码的字符串 |
|ciphers |String |- |- |使用或排除的cipher |
|secureProtocol |String |- |- |SSL 使用的方法,例如,
`SSLv3_method`
强制 SSL 版本为3。 |
|followRedirect |Boolean |- |false |收到3xx响应时是否自动重定向 |
|maxRedirects |Number |- |10 |最高重定向次数 |
|formatRedirectUrl |Function |- |- |手动格式化url |
|beforeRequest |Function |- |- |请求发送前的钩子 |
|streaming |Boolean |- |false |是否直接返回响应流,开启 streaming 之后,HttpClient 会在拿到响应对象 res 之后马上返回, 此时 result.headers 和 result.status 已经可以读取到,只是没有读取 data 数据而已。|
|gzip |Boolean |- |false |是否支持 gzip 响应格式。开启 gzip 之后,HttpClient 将自动设置 Accept-Encoding: gzip 请求头, 并且会自动解压带 Content-Encoding: gzip 响应头的数据。 |
|timing |Boolean |- |false |是否开启请求各阶段的时间测量 |
|enableProxy |Boolean |- |false |是否启用代理 |
|proxy |String |- |null | 代理地址 |
|lookup |Function |- |- |自定义DNS查询函数 |
|checkAddress |Function |- |- |校验请求地址 |
|trace |Boolean |- |false |是否启用捕获堆栈 |
**示例代码**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录