code: function checkResponseForErrors(res) {
      let { statusCode, body, headers } = res;
  
      if (statusCode >= 400) {
          return { error: true, body };
      }
  
      // API key is invalid
      if ((body.error) && (body.error === 'Unauthorized')) {
          return { error: true, body };
      }
  
      // response is not json
      if (headers['content-type'] !== 'application/json; charset=utf-8') {
          return { error: true, body: { error: 'JSON expected' } };
      }
  
      return { error: false, body };
  }
docs: /*
  Check for standard errors in the response object