Set request headers.
551464
@SafeVarargs
    public final RequestBuilder headers(Map.Entry<String, ?>... headers) {
        headers(Lists.of(headers));
        return this;
    }
163114
def get_headers(server):
    """"""
    try:
        response = requests.head(
            server, allow_redirects=False, verify=False, timeout=5)
    except requests.exceptions.ConnectionError:
        return False

    return dict(response.headers)
1031341
def set_header(self, name, value):
        '''  '''
        self._headers[_hkey(name)] = [str(value)]
652810
def set_all(params = self.class::DEFAULT_REQUEST_HEADER)
      params = params.data if params.class <= Resource
      params = Hash[params.map { |(k, v)| [k.to_s, v] }]
      params.each { |key, value| set(key.to_s, value) }
      self
    end
523747
protected function prepareHeaders()
    {
        if (!isset($this->headers['Content-Length'])) {

            $content_length = strlen($this->data);

            if ($content_length > 0 || $this->method === 'POST' || $this->method === 'PUT') {
                $this->headers['Content-Length'] = $content_length;
            }
        }

        if (isset($this->uri['user']) && !isset($this->headers['Authorization'])) {
            $pass = isset($this->uri['pass']) ? ':' . $this->uri['pass'] : ':';
            $this->headers['Authorization'] = 'Basic ' . base64_encode($this->uri['user'] . $pass);
        }
    }
831324
public OkRequest<T> headers(final Map<String, String> headers) {
        if (!headers.isEmpty())
            for (Map.Entry<String, String> header : headers.entrySet())
                header(header);
        return this;
    }
1177200
def set_default_headers(context):
    
    headers = row_table(context)

    def default_headers_function():
        return headers

    requestsdefaulter.default_headers(default_headers_function)
776496
protected function setHeaders() {
        $headers = $this->request->getHeaders()->toFlatArray();
        $this->resource->setOption(CURLOPT_HTTPHEADER, $headers);
    }
533994
def set_default_headers(self):
        '''
        
        '''
        mod_opts = self.application.mod_opts

        if mod_opts.get('cors_origin'):
            origin = self.request.headers.get('Origin')

            allowed_origin = _check_cors_origin(origin, mod_opts['cors_origin'])

            if allowed_origin:
                self.set_header("Access-Control-Allow-Origin", allowed_origin)
40621
def _set_default_headers(self):
        
        self.headers.setdefault('Date', self.get_current_time)
        self.headers.setdefault('Server', self.SERVER_INFO)
        self.headers.setdefault('Content-Length', "%d" % len(self.message))
        if self.app.enabled('x-powered-by'):
            self.headers.setdefault('X-Powered-By', 'Growler')
13361
def headers_to_include_from_request(curr_request):
    '''
        
    '''
    return {
        h: v for h, v in curr_request.META.items() if h in _settings.HEADERS_TO_INCLUDE}
96518
def headers_for_url(cls, url):
        """"""
        response = cls.http_request(url, method='HEAD')
        if response.status != 200:
            cls.raise_http_error(response)

        return Resource.headers_as_dict(response)
1155456
public void setRequestHeader(String header, String value) {
        LOG.entering(CLASS_NAME, "setRequestHeader", new Object[] {header, value});
        HttpRequestUtil.validateHeader(header);
        connection.addRequestProperty(header, value);
    }
220448
def request_headers(headers = {}, auth: true, gzip: true)
      headers = default_headers.merge(headers)
      headers.merge!(bearer_authorization_header) if auth
      headers[ACCEPT_ENCODING] = GZIP if gzip
      headers.reject{|_,v| v.nil? || (v.respond_to?(:empty?) && v.empty?)}
    end
754555
public final B setHeaders(Headers<AsciiString, String, ?> headers) {
        requireNonNull(headers, "headers");
        if (!headers.isEmpty()) {
            getOrCreateHeaders().setAll(headers);
        }
        return self();
    }
1305312
protected void setResponseHeaders(HttpServletResponse resp) {
		// Force resource caching as best as possible
		resp.setHeader(CACHE_CONTROL_HEADER, CACHE_CONTROL_VALUE);
		resp.setHeader(LAST_MODIFIED_HEADER, LAST_MODIFIED_VALUE);
		resp.setHeader(ETAG_HEADER, ETAG_VALUE);
		Calendar cal = Calendar.getInstance();
		cal.roll(Calendar.YEAR, 10);
		resp.setDateHeader(EXPIRES_HEADER, cal.getTimeInMillis());
	}
962755
private void setupHeaders(HttpURLConnection connection) {
        for (Map.Entry<String, Object> entry : getHeaders().entrySet()) {
            connection.setRequestProperty(entry.getKey(), String.valueOf(entry.getValue()));
        }
        connection.setDoOutput(true);
        connection.setDoInput(true);
        connection.setUseCaches(false);
        connection.setAllowUserInteraction(false);
    }