Creates a V2 format request from a V1 Postman Collection Request

@param {Object} requestV1 - The v1 request to be transformed.
@returns {Object} - The converted v2 request.
559905
function (requestV1) {
        var self = this,
            request = {},
            retainEmpty = self.options.retainEmptyValues,
            units = ['auth', 'method', 'header', 'body', 'url'];

        units.forEach(function (unit) {
            request[unit] = self[unit](requestV1);
        });

        if (requestV1.description) { request.description = requestV1.description; }
        else if (retainEmpty) { request.description = null; }

        return request;
    }
1120582
public ChannelBuffer formatJVMStatsV1(final Map<String, Map<String, Object>> map) {
    throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, 
        "The requested API endpoint has not been implemented", 
        this.getClass().getCanonicalName() + 
        " has not implemented formatJVMStatsV1");
  }
1230914
function normalizeRequestParameters (defaultsObject, paramsName, requestParams) {
  var promise = new Promise(function (resolve, reject) {
    var defaultParams;
    var onlyOne;
  
    // First check if we have a default parameters object with this name
    if (typeof defaultsObject[paramsName] !== 'object') reject(new RequiredError(`No default parameters for '${paramsName}'`, paramsName, defaultsObject[paramsName]));
    
    // Create an empty object with default parameters
    defaultParams = extend(Object.create(null), defaultsObject[paramsName]);
    
    // Check if there is only one required parameter in defaults
    onlyOne = checkIfOnlyOneRequired(defaultParams);
    
    // If checked parameters are not an object
    if (typeof requestParams !== 'object') {
      // If they are a string or a valid number and there is only one required parameter in default parameters
      if ((typeof requestParams === 'string' || (typeof requestParams === 'number' && isNaN(requestParams))) && onlyOne !== false) {
        // Provide this value as a value in the default params
        defaultParams[onlyOne] = requestParams;
      } else {
        // Reject with error in other case
        reject(new RequiredError('No request parameters provided', 'requestParams', requestParams));
      }
    }
    
    for (var key in defaultParams) {
      if (checkRequiredParameter(requestParams[key]) && defaultParams[key] === '') {
        reject(new RequiredError(`Missing required parameter '${key}'`, key, requestParams[key]));
      } else if (!checkRequiredParameter(requestParams[key])) {
        defaultParams[key] = requestParams[key];
      }
      if (defaultParams[key] === '__optional') defaultParams[key] = '';
    }
    
    resolve(defaultParams);
    
  });
  
  return promise;
}
736782
function reconstructUrl(path,request) {

    //Append query string
    if (Object.keys(request.queryParams).length > 0) {
        var str = [];
        for (var p in request.queryParams) {
            if (request.queryParams.hasOwnProperty(p) && p != '') {
                str.push(p + "=" + request.queryParams[p]);
            }
        }
        if ( str.length > 0 ){
            path += "?" + str.join("&");
        }
    }

    //Fix path parameters
    if (Object.keys(request.pathParams).length > 0) {
        for (var param in request.pathParams) {
            if (request.pathParams.hasOwnProperty(param)) {
                var toReplace = "{" + param + "}";
                path = path.replace(toReplace, request.pathParams[param]);
            }
        }
    }

    return path;
}
978711
def convert_v1_to_v2(
        dict  # type: Dict[str, Any]
    ):
    # type: (...) -> Dict[str, Any]
    
    version = dict['version']
    if version != 1:
        raise ValueError('Version {} not 1'.format(version))

    clk_config = dict['clkConfig']
    k = clk_config['k']
    clk_hash = clk_config['hash']

    def convert_feature(f):
        if 'ignored' in f:
            return f

        hashing = f['hashing']
        weight = hashing.get('weight', 1.0)

        if weight == 0:
            return {
                'identifier': f['identifier'],
                'ignored': True
            }

        x = deepcopy(f)
        hashing = x['hashing']
        if 'weight' in hashing:
            del hashing['weight']

        hashing['k'] = int(round(weight * k))
        hashing['hash'] = clk_hash
        return x

    result = {
        'version': 2,
        'clkConfig': {
            'l': clk_config['l'],
            'xor_folds': clk_config.get('xor_folds', 0),
            'kdf': clk_config['kdf']
        },
        'features': list(map(convert_feature, dict['features']))
    }
    return result
165765
function (requestV1) {
        if (_.isArray(requestV1.headers)) {
            return requestV1.headers;
        }

        var headers = [],
            traversed = {},
            headerData = requestV1.headerData || [],
            retainEmpty = this.options.retainEmptyValues;

        _.forEach(headerData, function (header) {
            if (_.startsWith(header.key, headersCommentPrefix) || (header.enabled === false)) {
                header.disabled = true;
                header.key = header.key.replace(headersCommentPrefix, '').trim();
            }

            // prevent empty header descriptions from showing up in converted results. This keeps the collections clean
            util.cleanEmptyValue(header, 'description', retainEmpty);

            delete header.enabled;
            headers.push(header); // @todo Improve this sequence to account for multi-valued headers

            traversed[header.key] = true;
        });

        // requestV1.headers is a string, so no descriptions can be obtained from it
        _.forEach(v1Common.parseHeaders(requestV1.headers), function (header) {
            !traversed[header.key] && headers.push(header);
        });

        return headers;
    }
866729
function requestToContext(req) {
  const queryMap = req.method === 'POST' ? req.body : _url2.default.parse(req.url, true).query;
  const context = {};

  if (queryMap) {
    Object.keys(queryMap).forEach(key => {
      let arg = queryMap[key];

      if (parseArgs[key] && arg) {
        context[key] = JSON.parse(arg);
      } else {
        context[key] = arg;
      }
    });
  }
  return Object.freeze(context);
}
1308963
function (requestV1) {
        var queryParams = [],
            pathVariables = [],
            traversedVars = {},
            queryParamAltered,
            traversedQueryParams = {},
            parsed = util.urlparse(requestV1.url),
            retainEmpty = this.options.retainEmptyValues;

        // Merge query params
        _.forEach(requestV1.queryParams, function (queryParam) {
            (queryParam.enabled === false) && (queryParam.disabled = true);

            delete queryParam.enabled;

            util.cleanEmptyValue(queryParam, 'description', retainEmpty);

            if (_.has(queryParam, 'equals')) {
                if (queryParam.equals) {
                    (queryParam.value === null) && (queryParam.value = '');
                    queryParamAltered = true;
                }
                else {
                    // = is not appended when the value is null
                    (queryParam.value === '') && (queryParam.value = null);
                    queryParamAltered = true;
                }
                delete queryParam.equals;
            }

            queryParams.push(queryParam);
            traversedQueryParams[queryParam.key] = true;
        });
        // parsed query params are taken from the url, so no descriptions are available from them
        _.forEach(parsed.query, function (queryParam) {
            !traversedQueryParams[queryParam.key] && queryParams.push(queryParam);
        });

        // Merge path variables
        _.forEach(requestV1.pathVariableData, function (pathVariable) {
            pathVariable = _.clone(pathVariable);
            util.cleanEmptyValue(pathVariable, 'description', retainEmpty);

            pathVariables.push(pathVariable);
            traversedVars[pathVariable.key] = true;
        });
        // pathVariables in v1 are of the form  {foo: bar}, so no descriptions can be obtained from them
        _.forEach(requestV1.pathVariables, function (value, id) {
            !traversedVars[id] && pathVariables.push({
                value: value,
                id: id
            });
        });

        !_.isEmpty(queryParams) && (parsed.query = queryParams);
        !_.isEmpty(pathVariables) && (parsed.variable = pathVariables);

        // If the query params have been altered, update the raw stringified URL
        queryParamAltered && (parsed.raw = util.urlunparse(parsed));

        // return the objectified URL only if query param or path variable descriptions are present, string otherwise
        return (parsed.query || parsed.variable) ? parsed : (parsed.raw || requestV1.url);
    }
395275
function parseDeleteRequest(req){
  var reqObj = {};
  reqObj.originalUrl = req.originalUrl;
  reqObj.uid = req.params.guid;
  reqObj.env =req.params.environment;
  reqObj.domain = req.params.domain;
  reqObj._id = req.params.id;
  return reqObj;
}
832051
function formatRequestString_(o) {
  var ret;
  if (typeof o === 'object') {
    if (isArray_(o)) {
      ret = [];
      for (var i = 0, I = o.length; i < I; i++) {
        ret.push(formatRequestString_(o[i]));
      }
      return '[' + ret.join(',') + ']';
    } else if (isOverlay_(o)) {
      return fromOverlaysToJSON_(o);
    } else if (o.toJSON) {
      return o.toJSON();
    } else {
      ret = '';
      for (var x in o) {
        if (o.hasOwnProperty(x)) {
          if (ret.length > 0) {
            ret += ', ';
          }
          ret += x + ':' + formatRequestString_(o[x]);
        }
      }
      return '{' + ret + '}';
    }
  }
  return o.toString();
}
667084
function(o1, o2) {
            var retObj = this._clone(o2);
            for(var key in o1) {
                if(this._isObject(o1[key])) {
                    retObj[key] = this._merge(o1[key], retObj[key]);
                }
                else {
                    retObj[key] = o1[key];
                }
            }
            return retObj;
        }
866040
def request_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/requests.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
637858
function makeHttpRequest(reqHeaders, expectedRes, cacheHitExpected, next) {
  reqHeaders.cookie = _.reduce(reqHeaders.cookie, function(memo, val, name) {
    memo.push(name + '=' + val);
    return memo;
  }, []).join('; ');

  var start = Date.now();

  request({
    url: 'http://localhost:1337',
    method: 'GET',
    headers: reqHeaders
  }, function(err, data, body) {
    var time = Date.now() - start;

    console.log('  status:', data.statusCode);
    console.log('  body  :', body);
    console.log('  time  :', time);

    common.verify(function() {
      JSON.parse(body).should.eql(expectedRes);
      common.shouldUseCache(cacheHitExpected, time);
    });

    next();
  });
}
792093
public static int compareMavenVersions(String v1, String v2) {
		return parseMavenVersion(v1).compareTo(parseMavenVersion(v2));
	}
32862
function request_params(params) {
  'use strict';
  var base_params, merged_params, key;

  // Omit defaults, to make smaller requests
  // output: 'JSON',
  // version: '2',
  // validation: 'HMACSHA1'  
  base_params = { apikey: global.monitis.apikey };
  merged_params = {};

  for (key in base_params) {
    merged_params[key] = base_params[key];
  }
  for (key in params) {
    merged_params[key] = params[key];
  }
  return merged_params;
}
1041759
function requestHandler(req, res, next) {
  const params = req && req.params;
  const start = Date.now();
  let source;
  let opts;

  return Promise.try(() => {
    source = core.getPublicSource(params.src);

    if (!_.contains(source.formats, params.format)) {
      throw new Err('Format %s is not known', params.format).metrics('err.req.format');
    }

    params.z = core.validateZoom(params.z, source);
    params.scale = core.validateScale(params.scale, source);

    params.x = checkType.strToInt(params.x);
    params.y = checkType.strToInt(params.y);
    if (
      !qidx.isValidCoordinate(params.x, params.z) || !qidx.isValidCoordinate(params.y, params.z)
    ) {
      throw new Err('x,y coordinates are not valid, or not allowed for this zoom').metrics('err.req.coords');
    }

    opts = {
      z: params.z,
      x: params.x,
      y: params.y,
    };
    if (params.format !== 'pbf') {
      // Ensure that PNGs are not 32bit
      // TODO: this should be source-configurable
      opts.format = params.format === 'png' ? 'png8:m=h' : params.format;
      if (params.scale) {
        opts.scale = params.scale;
      }
    }
    if (req.query && req.query.lang) {
      if (!langCodeRe.test(req.query.lang)) {
        throw new Err('lang param is not valid').metrics('err.req.lang');
      }
      opts.lang = req.query.lang;
    }

    // fixme: Force all tiles to be treated as vector
    opts.treatAsVector = true;

    return source.getHandler().getAsync(opts);
  }).then((result) => {
    let mx;

    core.setResponseHeaders(res, source, result.headers);

    if (params.format === 'json') {
      // Allow JSON to be shortened to simplify debugging
      res.json(filterJson(req.query, result.data));
    } else {
      res.send(result.data);
    }

    mx = util.format('req.%s.%s.%s', params.src, params.z, params.format);
    if (params.scale) {
      // replace '.' with ',' -- otherwise grafana treats it as a divider
      mx += `.${params.scale.toString().replace('.', ',')}`;
    }
    core.metrics.endTiming(mx, start);
  }).catch(err => core.reportRequestError(err, res)).catch(next);
}
662436
@Column(header = "V1 (%(v1))", order = 40)
    public String getV1() {

        return CmsValueCompareBean.formatContentValueForDiffTable(m_cms, m_elemComp, m_elemComp.getVersion1());
    }