Attempt to replace headers
482421
static function replaceHeaders(array $newHeaders): bool
    {
        if (!headers_sent()) {
            header_remove();

            foreach ($newHeaders as $header) {
                header($header);
            }

            return true;
        }

        return false;
    }
675835
def prepare_headers(self, headers):
        """"""

        if headers:
            self.headers = CaseInsensitiveDict((to_native_string(name), value) for name, value in headers.items())
        else:
            self.headers = CaseInsensitiveDict()
931470
def _AddHeader(self, fp):
    
    text = textwrap.wrap(
        textwrap.dedent(self.config_header), break_on_hyphens=False)
    fp.write('\n'.join(['# ' + line for line in text]))
    fp.write('\n\n')
1192206
def pre_process_method_headers(method, headers):
    '''
        
    '''
    method = method.lower()

    # Standard WSGI supported headers
    _wsgi_headers = ["content_length", "content_type", "query_string",
                     "remote_addr", "remote_host", "remote_user",
                     "request_method", "server_name", "server_port"]

    _transformed_headers = {}

    # For every header, replace - to _, prepend http_ if necessary and convert
    # to upper case.
    for header, value in headers.items():

        header = header.replace("-", "_")
        header = "http_{header}".format(
            header=header) if header.lower() not in _wsgi_headers else header
        _transformed_headers.update({header.upper(): value})

    return method, _transformed_headers
66046
def ensure_headers
      missing = missing_headers
      return if missing.size == 0

      message = "Compilation cannot proceed as the following header files are missing:\n" + missing.join("\n") 
      raise Error.new(message)
    end
1202697
def header(self, headers):
        
        if isinstance(headers, list):
            for h in headers:
                self.add_header(h)
        else:
            self.add_header(headers)
164637
public GenericResponseBuilder<T> replaceAll(MultivaluedMap<String, Object> headers) {
    rawBuilder.replaceAll(headers);
    return this;
  }
1367863
def update_headers(self, headers: Optional[LooseHeaders]) -> None:
        """"""
        self.headers = CIMultiDict()  # type: CIMultiDict[str]

        # add host
        netloc = cast(str, self.url.raw_host)
        if helpers.is_ipv6_address(netloc):
            netloc = '[{}]'.format(netloc)
        if not self.url.is_default_port():
            netloc += ':' + str(self.url.port)
        self.headers[hdrs.HOST] = netloc

        if headers:
            if isinstance(headers, (dict, MultiDictProxy, MultiDict)):
                headers = headers.items()  # type: ignore

            for key, value in headers:
                # A special case for Host header
                if key.lower() == 'host':
                    self.headers[key] = value
                else:
                    self.headers.add(key, value)
926147
def AddHeader(self, header, value):
        '''
        '''
        self.user_headers.append((header, value))
        return self
687360
function(key, value) {
          const key2 = key.toLowerCase().replace(/[^a-z0-9]/ig, '');
          res.serverassist.headers[key]    = value;
          res.serverassist.headers2[key2]  = value;
        }
246589
def echo_headers(headers, file=None):
    """"""
    for k, v in sorted(headers.items()):
        click.echo("{0}: {1}".format(k.title(), v), file=file)
    click.echo(file=file)
746507
function replace(targetStr, searchStr, replaceStr, nPrev, nNext) {
  let result = targetStr;
  for (let i = 0; i < result.length; ++i) {
    if (result.substr(i, searchStr.length) === searchStr &&
      checkSubStr(result, i - nPrev.length, nPrev) === false &&
      checkSubStr(result, i + searchStr.length, nNext) === false) {
      result = result.slice(0, i) + replaceStr + result.slice(i + searchStr.length);
    }
  }
  return result;
}
1281502
def _adjust_header(cls, type_, orig_header):
        
        pattern = 'pythonw.exe'
        repl = 'python.exe'
        if type_ == 'gui':
            pattern, repl = repl, pattern
        pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
        new_header = pattern_ob.sub(string=orig_header, repl=repl)
        return new_header if cls._use_header(new_header) else orig_header
778838
function normalizeHeaders(headers)
{
  var ret = headers;

  if (Util.isObject(headers))
  {
    ret = {};

    // shallow copy the headers object and convert some headers like 'Accept'
    // and 'Content-Type' to lower case while copying; this is necessary
    // because the browser-request module, which we use to make http requests in
    // the browser, does not do case-insensitive checks when deciding whether to
    // insert default values for the 'accept' and 'content-type' headers; in
    // otherwise, if someone specifies an 'Accept': 'application/json' header,
    // browser-request will inject its own 'accept': 'application/json' header
    // and the browser XMLHttpRequest object will concatenate the two values and
    // send 'Accept': 'application/json, application/json' with the request
    var headerNameLowerCase;
    for (var headerName in headers)
    {
      if (headers.hasOwnProperty(headerName))
      {
        headerNameLowerCase = headerName.toLowerCase();
        if ((headerNameLowerCase === 'accept') ||
            (headerNameLowerCase === 'content-type'))
        {
          ret[headerNameLowerCase] = headers[headerName];
        }
        else
        {
          ret[headerName] = headers[headerName];
        }
      }
    }
  }

  return ret;
}
954514
def fix_headers!(env)
      env.keys.select { |k| k =~ /^HTTP_X_/ }.each do |k|
        env[k.gsub("HTTP_", "")] = env[k]
        env.delete(k)
      end
      env
    end
321727
def update_headers(self, dictionary, keys=None):
        
        if keys is None: keys = list(dictionary.keys())
        for k in keys: self.insert_header(k, dictionary[k])
        return self
133603
private void replaceHeaders(final Message from, final Message to) {
        to.getHeaders().clear();
        to.getHeaders().putAll(from.getHeaders());
    }