code: function parseResponse(res, body, resolve, reject) {
    try {
      if (!/application\/json/.test(res.headers['content-type']) || body.trim() === '') {
        return resolve(body);
      }
  
      const json = JSON.parse(body);
  
      if (json.error || json.errors) {
        const err = new Error(json.error || JSON.stringify(json.errors));
  
        return reject(err);
      }
  
      return resolve(json);
    } catch (e) {
      e.responseBody = body;
      return reject(e);
    }
  }
docs: Parse response