Serializes a map of request headers to be used in a $batch request.

@param {object} mHeaders
A map of request headers
@returns {object[]} Array representing the serialized headers
166381
function serializeHeaders(mHeaders) {
		var sHeaderName,
			aHeaders = [];

		for (sHeaderName in mHeaders) {
			aHeaders = aHeaders.concat(sHeaderName, ":", mHeaders[sHeaderName], "\r\n");
		}

		return aHeaders;
	}
1113023
@SuppressWarnings("unchecked")
	public T setHeaders(final Map<String, List<String>> headers) {
		this.headers = headers;
		return (T) this;
	}
1330499
function setHeaders($headers) {
      if (is_array($headers)) {
        reset($headers);
        while (list($name, $value) = each($headers)) {
          $this->requestHeaders[$name] = $value;
        }
      }
    }
619799
protected static Map<String, String> convertHeaders(Header[] headers) {
        Map<String, String> result = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
        for (int i = 0; i < headers.length; i++) {
            result.put(headers[i].getName(), headers[i].getValue());
        }
        return result;
    }
590948
protected function prepareHeaders(array $headers)
    {
        $preparedHeaders = [];

        foreach ($headers as $strName => $varValue) {
            $preparedHeaders[] = $strName.': '.$varValue;
        }

        return $preparedHeaders;
    }
503173
public Header[] head(String endpoint, String params) throws IOException {
        return this.head(endpoint, params, "");
    }
765792
private function convertHeaders(array $headers)
    {
        $result = [];
        foreach ($headers as $key => $value) {
            $result[] = $key . ': ' . $value;
        }

        return $result;
    }
310725
function headersToJSON(s) {
			var r = {};
			var reg = /([a-z\-]+):\s?(.*);?/gi;
			var m;
			while ((m = reg.exec(s))) {
				r[m[1]] = m[2];
			}

			return r;
		}
441694
@Override
    public Map<String, List<String>> headers() {
        if (headers != null) {
            return headers;
        }
        headers = new HashMap<>();
        final MultiMap requestHeaders = request.headers();
        Set<String> names = requestHeaders.names();
        for (String name : names) {
            headers.put(name, requestHeaders.getAll(name));
        }
        return headers;
    }
450666
function reqToJSON () {
  const {ip, method, url, headers} = this
  const userAgent = headers ? headers['user-agent'] : void (0)
  return {ip, method, url, userAgent}
}
914362
private String[] responseHeaders( final String name ) {
        final Map<String, List<String>> headers = responseHeaders();
        if( headers == null || headers.isEmpty() )
            return EMPTY_STRINGS;

        final List<String> values = headers.get(name);
        if( values != null && !values.isEmpty() )
            return values.toArray(new String[values.size()]);
        else
            return EMPTY_STRINGS;
    }
1082124
public Map<String, String> getCustomRequestHeaders() {
        if (customRequestHeaders == null) {
            return null;
        }
        return Collections.unmodifiableMap(customRequestHeaders);
    }
529933
public TDHttpClient withHeaders(Multimap<String, String> headers)
    {
        Multimap<String, String> mergedHeaders = ImmutableMultimap.<String, String>builder()
                .putAll(this.headers)
                .putAll(headers)
                .build();
        return new TDHttpClient(config, httpClient, objectMapper, mergedHeaders);
    }
1252133
function setHeaders(req, headers) {
        var i;
        for (i = 0; i < headers.length; ++i) {
            req.setRequestHeader(headers[i][0], headers[i][1]);
        }
    }
551075
public static Map<String, String> headers(){
        Map<String, String> headers = new HashMap<>();
        Enumeration<String> names = RequestContext.getHttpRequest().getHeaderNames();
        while (names.hasMoreElements()) {
            String name = names.nextElement();
            headers.put(name, RequestContext.getHttpRequest().getHeader(name));
        }
        return headers;
    }
357369
function validateHeaders (headers) {
  const aggr = []
  for (let [key, value] of headers)
    aggr.push(validateHeader(key, value))
  return aggr
}
1228057
@Trivial
    private String dumpMap(Map<String, String[]> m) {
        StringBuffer sb = new StringBuffer();
        sb.append(" --- request parameters: ---\n");
        Iterator<String> it = m.keySet().iterator();
        while (it.hasNext()) {
            String key = it.next();
            String[] values = m.get(key);
            sb.append(key + ": ");
            for (String s : values) {
                sb.append("[" + s + "] ");
            }
            sb.append("\n");
        }
        return sb.toString();
    }