code: function(request) {
    var options = {};
  
    if (request.getQueryParameters()) {
      options.query = request.getQueryParameters();
    }
  
    if (
      request.getHeaders() &&
      request.getHeaders()['Content-Type'] === 'application/json'
    ) {
      options.data = JSON.stringify(request.getBodyParameters());
    } else if (request.getBodyParameters()) {
      options.data = request.getBodyParameters();
    }
  
    if (request.getHeaders()) {
      options.headers = request.getHeaders();
    }
    return options;
  }
docs: /* Create superagent options from the base request