egg

作者: 三省吾身_9862 | 来源:发表于2021-12-24 14:39 被阅读0次
  • curl请求,传参格式
const params = {
        method,
        headers: filterHeaders,
        contentType: 'json',
        data: method.toLocaleLowerCase() === 'get' ? query : body,
};
ctx.curl(url, params).then(res => {})

参数:

curl(url, optionsopt)

Parameters:

Name Type Description
url String | Object request url address.
[ options ] Object options for request.

options:Object-Config

Name Description
method 请求方法,默认为GET。可以是GET,POST,DELETE或PUT
data 要发送的数据。将自动进行字符串化
dataType 字符串-响应数据的类型。可能是text或json
headers 请求标头
timeout 请求超时
auth username:password在HTTP基本授权中使用
gzip 让您在请求连接时获取res对象,默认为false
nestedQuerystring urllib默认使用querystring对不支持嵌套对象的表单数据进行字符串化,通过将此选项设置为true,将使用qs而不是querystring支持嵌套对象

相关文章

网友评论

      本文标题:egg

      本文链接:https://www.haomeiwen.com/subject/hoblqrtx.html