{"size": 605, "ext": "js", "max_stars_repo_path": "lib/adapters/wx-request.js", "max_stars_repo_name": "SoloJiang/axios", "max_stars_repo_stars_event_min_datetime": "2018-12-27T04:58:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-24T14:03:44.000Z", "max_issues_repo_path": "lib/adapters/wx-request.js", "max_issues_repo_name": "SoloJiang/axios", "max_issues_repo_issues_event_min_datetime": "2018-10-09T03:29:44.000Z", "max_issues_repo_issues_event_max_datetime": "2018-10-09T03:29:44.000Z", "max_forks_repo_path": "lib/adapters/wx-request.js", "max_forks_repo_name": "SoloJiang/axios", "max_forks_repo_forks_event_min_datetime": "2018-11-30T06:39:36.000Z", "max_forks_repo_forks_event_max_datetime": "2018-11-30T06:39:36.000Z"}
{"max_stars_count": 8, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 24.2, "max_line_length": 75, "alphanum_fraction": 0.6}
var buildURL = require("./../helpers/buildURL");

module.exports = function wxAdapter(config) {
  return new Promise(function dispatchWxRequest(resolve, reject) {
    var data = config.data;
    var headers = config.headers;
    var request = wx.request;
    var url = buildURL(config.url, config.params, config.paramsSerializer);

    request({
      url: url,
      method: config.method.toUpperCase(),
      data: data,
      header: headers,
      success: function(res) {
        res.config = config;
        resolve(res);
      },
      fail: function() {
        reject();
      }
    });
  });
};
