Constructs an array of Key-Values from a raw HTTP Header string.

@param {Object} requestV1 - The v1 request to extract header information from.
@returns {Object[]} - A list of header definition objects.
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;
    }
1251782
function pruneHeaders(requestHeaders) {
  const headers = Object.assign({}, requestHeaders);

  delete headers.trackingid;
  delete headers.authorization;

  return headers;
}
123205
function(params, headers, callback) {
        var url;
        url = this.client.url(false);
        return this.client.get(url, params, headers, callback);
      }
450666
function reqToJSON () {
  const {ip, method, url, headers} = this
  const userAgent = headers ? headers['user-agent'] : void (0)
  return {ip, method, url, userAgent}
}
392554
private static Map<String, String> __getRequestHeaderMap(HttpServletRequest req) {
        Map<String, String> reqHeaders = new LinkedHashMap<>();
        Enumeration<String> headerNames = req.getHeaderNames();
        if (headerNames != null) {
            while (headerNames.hasMoreElements()) {
                String headerName = headerNames.nextElement();
                Enumeration<String> headerValues = req.getHeaders(headerName);

                if (headerValues != null) {
                    StringBuilder headerValueBuilder = new StringBuilder();
                    int i = 0;
                    while (headerValues.hasMoreElements()) {
                        if (i > 0) {
                            headerValueBuilder.append(", ");
                        }

                        headerValueBuilder.append(headerValues.nextElement());
                        i++;
                    }

                    reqHeaders.put(headerName, headerValueBuilder.toString());
                } else {
                    reqHeaders.put(headerName, "");
                }
            }
        }
        return reqHeaders;
    }
823541
protected List<String> resolveEventFromHttpRequest(final HttpServletRequest request) {
        val mfaRequestHeader = casProperties.getAuthn().getMfa().getRequestHeader();
        val headers = request.getHeaders(mfaRequestHeader);
        if (headers != null && headers.hasMoreElements()) {
            LOGGER.debug("Received request header [{}] as [{}]", mfaRequestHeader, headers);
            return Collections.list(headers);
        }

        val mfaRequestParameter = casProperties.getAuthn().getMfa().getRequestParameter();
        val params = request.getParameterValues(mfaRequestParameter);
        if (params != null && params.length > 0) {
            LOGGER.debug("Received request parameter [{}] as [{}]", mfaRequestParameter, params);
            return Arrays.stream(params).collect(Collectors.toList());
        }

        val attributeName = casProperties.getAuthn().getMfa().getSessionAttribute();
        val session = request.getSession(false);
        var attributeValue = session != null ? session.getAttribute(attributeName) : null;
        if (attributeValue == null) {
            LOGGER.trace("No value could be found for session attribute [{}]. Checking request attributes...", attributeName);
            attributeValue = request.getAttribute(attributeName);
        }

        if (attributeValue == null) {
            LOGGER.trace("No value could be found for [{}]", attributeName);
            return null;
        }

        val values = CollectionUtils.toCollection(attributeValue);
        LOGGER.debug("Found values [{}] mapped to attribute name [{}]", values, attributeName);
        return values.stream().map(Object::toString).collect(Collectors.toList());
    }
975019
function extractRequestIds(resp) {
    var extendedRequestId = resp.httpResponse.headers ? resp.httpResponse.headers['x-amz-id-2'] : null;
    var cfId = resp.httpResponse.headers ? resp.httpResponse.headers['x-amz-cf-id'] : null;
    resp.extendedRequestId = extendedRequestId;
    resp.cfId = cfId;

    if (resp.error) {
      resp.error.requestId = resp.requestId || null;
      resp.error.extendedRequestId = extendedRequestId;
      resp.error.cfId = cfId;
    }
  }
64178
private static Map<String, String> getHeadersAsHashMap(HttpServletRequest request) {
      Map<String, String> headers = new HashMap<String, String>();
      
      for (Enumeration<?> h=request.getHeaderNames(); h.hasMoreElements();) {
         String headerName = (String) h.nextElement();
         String headerValue = request.getHeader(headerName);
         headers.put(headerName.toLowerCase(), headerValue);
      }
      
      return headers;
      
   }
172826
def _get_forwarded(request, key):
        
        forwarded = request.headers.get('Forwarded', '')
        match = re.search(
            r'(?<={}=).+?(?=[\s,;]|$)'.format(key),
            forwarded,
            re.IGNORECASE)

        if match is not None:
            header = match.group(0)

            if header[0] == '"' and header[-1] == '"':
                return header[1:-1]

            return header

        return request.headers.get('X-Forwarded-{}'.format(key.title()), '')
978689
function getFirstHeader (req, header) {
  const value = req.headers[header]
  return (Array.isArray(value) ? value[0] : value).split(', ')[0]
}
941940
function (headerString) {
        var headers = [],
            regexes = {
                header: /^(\S+):(.*)$/gm,
                fold: /\r\n([ \t])/g,
                trim: /^\s*(.*\S)?\s*$/
            },
            match = regexes.header.exec(headerString);
        headerString = headerString.toString().replace(regexes.fold, '$1');

        while (match) {
            headers.push({
                key: match[1],
                value: match[2].replace(regexes.trim, '$1')
            });
            match = regexes.header.exec(headerString);
        }
        return headers;
    }
931414
function Request_getRequestHeader(key) {
        if (Type.isString(key)) {
            return this.request.headers[key.toLowerCase()];
        } else {
            throw new error.HttpError(500, {key: key}, "Request.getRequestHeader: Header key must be string type");
        }
    }
1086805
function (requestV1) {
        var modes = {
                urlencoded: 'urlencoded',
                params: 'formdata',
                raw: 'raw',
                binary: 'file'
            },
            data = {},
            rawModeData,
            dataMode = modes[requestV1.dataMode],
            retainEmpty = this.options.retainEmptyValues;

        // set null body if neither data|rawModeData nor dataMode is set, or if the dataMode is explicitly set to null
        // The explicit null check is added to ensure that body is not set in case the dataMode was set to null by the
        // app, but `data` or `rawModeData` was not empty
        if ((!dataMode && _.isEmpty(requestV1.data) && _.isEmpty(requestV1.rawModeData)) ||
            requestV1.dataMode === null) {
            return retainEmpty ? null : undefined;
        }

        // set `rawModeData` if its a string
        if (_.isString(requestV1.rawModeData)) {
            rawModeData = requestV1.rawModeData;
        }
        // check if `rawModeData` is an array like: ['rawModeData']
        else if (Array.isArray(requestV1.rawModeData) &&
            requestV1.rawModeData.length === 1 &&
            _.isString(requestV1.rawModeData[0])) {
            rawModeData = requestV1.rawModeData[0];
        }

        // set data.mode.
        // if dataMode is not set, infer from data or rawModeData
        // at this point either data or rawModeData is set
        if (dataMode) {
            data.mode = dataMode;
        }
        // set `formdata` if rawModeData is not set and data is an array
        // `data` takes higher precedence over `rawModeData`.
        else if (!rawModeData && Array.isArray(requestV1.data || requestV1.rawModeData)) {
            data.mode = 'formdata';
        }
        // set `raw` mode as default
        else {
            data.mode = 'raw';
        }

        if (data.mode === 'raw') {
            if (rawModeData) {
                data[data.mode] = rawModeData;
            }
            else if (_.isString(requestV1.data)) {
                data[data.mode] = requestV1.data;
            }
            else {
                data[data.mode] = ''; // empty string instead of retainEmpty check to have parity with other modes.
            }
        }
        else if (data.mode === 'file') {
            data[data.mode] = { src: rawModeData }; // rawModeData can be string or undefined.
        }
        else {
            // parse data for formdata or urlencoded data modes.
            // `rawModeData` is checked in case its of type `data`.
            data[data.mode] = parseFormData(requestV1.data || requestV1.rawModeData, retainEmpty);
        }

        if (requestV1.dataDisabled) { data.disabled = true; }
        else if (retainEmpty) { data.disabled = false; }

        return data;
    }
169581
public List<String> getValuesList(HttpHeader header) {
        final List<String> list = new ArrayList<>();
        for (HttpField f : this)
            if (f.getHeader() == header)
                list.add(f.getValue());
        return list;
    }
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;
    }
439494
def read_request_headers(request)
      headers = {}
      request.env.keys.each do |key|
        if EXCLUDE_REQUEST_HEADER_PATTERNS.all? { |p| !key.starts_with? p }
          headers.merge!(cleanup_header(key) => request.env[key])
        end
      end
      headers
    end
1301842
private Map<String, Set<String>> getParameters(HttpServletRequest request) {
        Map<String, String[]> params = request.getParameterMap();

        Map<String, Set<String>> queryParameters = new HashMap<>(params.size());
        for (Map.Entry<String, String[]> entry : params.entrySet()) {
            queryParameters.put(entry.getKey(), new HashSet<>(Arrays.asList(entry.getValue())));
        }
        return queryParameters;
    }