Updates or inserts the given header.

@param {Object} header
960493
function (header) {
        if (!(header && header.key)) { return; } // if no valid header is provided, do nothing

        var existing = this.headers.find({ key: header.key });

        if (!existing) {
            return this.headers.add(header);
        }

        existing.value = header.value;
    }
676816
def set_header(self, key, value):
    
    self.conn.issue_command("Header", _normalize_header(key), value)
1052214
function addExtraHeaders(request, headers) {
        for (var name in headers) {
            request.setRequestHeader(name, headers[name]);
        }
    }
272957
def add(key, value, raw = nil)
      new_header = Redhead::Header.new(key, raw || TO_RAW[key], value)
      self << new_header
      new_header
    end
1338471
public void addHeader(String s) throws IOException
    {
        Integer h=(Integer)__headerMap.get(s);
        if (h!=null)
            addInt(h.intValue());
        else
            addString(s);
    }
757934
function _setResponseHeaders(headers) {
    this.responseHeaders = {};

    for (var header in headers) {
      if (headers.hasOwnProperty(header)) {
          this.responseHeaders[header] = headers[header];
      }
    }

    if (this.forceMimeType) {
      this.responseHeaders['Content-Type'] = this.forceMimeType;
    }

    if (this.async) {
      this._readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED);
    } else {
      this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED;
    }
  }
417717
def set_header(self, name, value, append=False):
        '''  '''
        if append:
            self.add_header(name, value)
        else:
            self._headers[_hkey(name)] = [str(value)]
811088
public function addCustomHeader($header)
    {
        self::$headers[self::CUSTOM_HEADERS][] = $this->normalizeHeaderName($header);
        return $this;
    }
1350733
@Override
    public void setRequestHeader(Header header) {
        
        Header[] headers = getRequestHeaderGroup().getHeaders(header.getName());
        
        for (int i = 0; i < headers.length; i++) {
            getRequestHeaderGroup().removeHeader(headers[i]);
        }
        
        getRequestHeaderGroup().addHeader(header);
        
    }
106004
function header (request) {

    var headers = assign({}, Http.headers.common,
        !request.crossOrigin ? Http.headers.custom : {},
        Http.headers[toLower(request.method)]
    );

    each(headers, function (value, name) {
        if (!request.headers.has(name)) {
            request.headers.set(name, value);
        }
    });

}
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
328009
function Request_addHeader(key, value) {
        var item;
        if (Type.isString(key)) {
            key = key.toLowerCase();
            if (!Type.isString(value) && !!value && Type.isFunction(value.toString)) {
                value = value.toString();
            }
            if (Type.isString(value)) {
                if (this.hasHeader(key) && !Type.isArray(this.headers[key])) {
                    item = this.getHeader(key);
                    this.headers[key] = [];
                    this.headers[key].push(item);
                    this.headers[key].push(value);
                } else if (this.hasHeader(key) && Type.isArray(this.headers[key])) {
                    this.headers[key].push(value);
                } else {
                    this.headers[key] = value;
                }
            }
        } else {
            throw new error.HttpError(500, {
                key: key,
                value: value
            }, "Request.addHeader: Header key must be string type");
        }
    }
261402
def add_header(self, key, value):
        

        assert isinstance(key, str), 'header key must be of type str'
        assert isinstance(value, str), 'header value must be of type str'
        self.headers[key] = value
972438
def set_header(self,header):
        
        self.header = header
        self.root.insert(0,header.get_node())
335986
public function setHttpHeader($header)
    {
        $headers = $this->getHttpHeaders();
        $headers[] = $header;
        $this->setHttpHeaders($headers);

    }
774452
private void addHeaders(HttpRequest request, Map<String, String> headers) {
		for (Map.Entry<String, String> key : headers.entrySet()) {
			request.addHeader(key.getKey(), key.getValue());
		}
	}
1058666
public void writeHeader(String header, Charset charset) throws IOException
	{
		if (!file.exists() && header != null)
		{
			IO.writeFile(file, Text.appendNewLine(header), charset);
		}
	}