2***@qq.com
2***@qq.com
  • 发布:2024-08-06 16:01
  • 更新:2024-08-06 17:58
  • 阅读:104

uniCloud.httpProxyForEip.get 怎么设置 headers

分类:uniCloud

更新日志显示支持Headers了,请问具体要怎么用,文档示例:

uniCloud.httpProxyForEip.get(url: String, params?: Object)
示例

await uniCloud.httpProxyForEip.get(  
  'https://api.weixin.qq.com/cgi-bin/token',  
  {  
    grant_type: 'client_credential',  
    appid: 'xxxx',  
    secret: 'xxxx'  
  }  
)

示例里没有headers啊。
2024-03-06
新增 uniCloud.httpProxyForEip.get API支持 headers 字段了

2024-08-06 16:01 负责人:无 分享
已邀请:
DCloud_uniCloud_CRL

DCloud_uniCloud_CRL

第三个参数是headers,文档我更新一下。

  • 2***@qq.com (作者)

    你好我试了一下,请求失败了,报错是Http头Authorization值格式错误。


    let Header = {"Authorization":"WECHATPAY2-SHA256-RSA2048 mchid=\"1630343483\",serial_no=\"6DAB692DDEFE3D709123C819945607FAC6C331A3\",nonce_str=\"14D3E612446766A054C51600968707D2\",timestamp=\"1722989546\",signature=\"N2MkXDiP8vOQWwF1tlL51UF1VaGKRAUW1gbBb72F0JtGhfz2txwNfT3Vm2R34pRaLguuQLC7+Ku6qQCx1i/a9thaDb8BYuFnsAMtgnj0Z4eIFQ7ip5dd0WYvFIJ1Atnxc/umoUeEdg8XDsV3LESOwfSaIVMybvKdMHUG2s1kKjzQP7SVNrx1tddjGfz8fd5VteSgxHWQ5tL94vWZvhsEg20xzVdX4j37w3TetImRN55mMoIdkV8LHeytBVI8wqdCnscIOJUzPTTnndad9+ao+QG443bNUXp0ivD6QwoNBXqIVxNCCfSfjepUqmO3/2DpiQ35IdcC/fFoYylJpwGu3g==\"","Accept":"application/json"};  
    uniCloud.httpProxyForEip.get(url,{},Header);

    2024-08-07 08:17

  • DCloud_uniCloud_CRL

    回复 2***@qq.com: 那这说明headers是生效了,你检查下Authorization格式是否正确

    2024-08-07 11:32

要回复问题请先登录注册