cos-wx-sdk-v5 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2772,7 +2772,8 @@ var defaultOptions = {
2772
2772
  UploadCheckContentMd5: false,
2773
2773
  UploadIdCacheLimit: 50,
2774
2774
  UseAccelerate: false,
2775
- ForceSignHost: true // 默认将host加入签名计算,关闭后可能导致越权风险,建议保持为true
2775
+ ForceSignHost: true, // 默认将host加入签名计算,关闭后可能导致越权风险,建议保持为true
2776
+ HttpDNSServiceId: '' // HttpDNS 服务商 Id,填写后代表开启 HttpDNS 服务。HttpDNS 用法详见https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html
2776
2777
  };
2777
2778
 
2778
2779
  // 对外暴露的类
@@ -2811,7 +2812,7 @@ COS.util = {
2811
2812
  json2xml: util.json2xml
2812
2813
  };
2813
2814
  COS.getAuthorization = util.getAuth;
2814
- COS.version = '1.2.0';
2815
+ COS.version = '1.2.1';
2815
2816
 
2816
2817
  module.exports = COS;
2817
2818
 
@@ -9641,6 +9642,7 @@ function _submitRequest(params, callback) {
9641
9642
  var body = params.body;
9642
9643
  var json = params.json;
9643
9644
  var rawBody = params.rawBody;
9645
+ var httpDNSServiceId = self.options.HttpDNSServiceId;
9644
9646
 
9645
9647
  // url
9646
9648
  if (self.options.UseAccelerate) {
@@ -9672,7 +9674,8 @@ function _submitRequest(params, callback) {
9672
9674
  qs: params.qs,
9673
9675
  filePath: params.filePath,
9674
9676
  body: body,
9675
- json: json
9677
+ json: json,
9678
+ httpDNSServiceId: httpDNSServiceId
9676
9679
  };
9677
9680
 
9678
9681
  // 兼容ci接口
@@ -9906,6 +9909,7 @@ var request = function request(params, callback) {
9906
9909
  var url = params.url || params.Url;
9907
9910
  var method = params.method;
9908
9911
  var onProgress = params.onProgress;
9912
+ var httpDNSServiceId = params.httpDNSServiceId;
9909
9913
  var requestTask;
9910
9914
 
9911
9915
  var cb = function cb(err, response) {
@@ -9971,7 +9975,7 @@ var request = function request(params, callback) {
9971
9975
  url += (url.indexOf('?') > -1 ? '&' : '?') + qsStr;
9972
9976
  }
9973
9977
  headers['Content-Length'] && delete headers['Content-Length'];
9974
- requestTask = wx.request({
9978
+ var requestParams = {
9975
9979
  url: url,
9976
9980
  method: method,
9977
9981
  header: headers,
@@ -9984,7 +9988,14 @@ var request = function request(params, callback) {
9984
9988
  fail: function fail(response) {
9985
9989
  cb(response.errMsg, response);
9986
9990
  }
9987
- });
9991
+ };
9992
+ if (httpDNSServiceId) {
9993
+ Object.assign(requestParams, {
9994
+ enableHttpDNS: true,
9995
+ httpDNSServiceId: httpDNSServiceId
9996
+ });
9997
+ }
9998
+ requestTask = wx.request(requestParams);
9988
9999
  }
9989
10000
 
9990
10001
  return requestTask;