Fill in the basic headers on http_request.
500438
def __SetBaseHeaders(self, http_request, client):
        """"""
        # TODO(craigcitro): Make the default a little better here, and
        # include the apitools version.
        user_agent = client.user_agent or 'apitools-client/1.0'
        http_request.headers['user-agent'] = user_agent
        http_request.headers['accept'] = 'application/json'
        http_request.headers['accept-encoding'] = 'gzip, deflate'
774452
private void addHeaders(HttpRequest request, Map<String, String> headers) {
		for (Map.Entry<String, String> key : headers.entrySet()) {
			request.addHeader(key.getKey(), key.getValue());
		}
	}
269948
def convert_http_request(request, referrer_host=None):
    '''
    '''
    new_request = urllib.request.Request(
        request.url_info.url,
        origin_req_host=referrer_host,
    )

    for name, value in request.fields.get_all():
        new_request.add_header(name, value)

    return new_request
956163
def _headers(self, others={}):
        """"""
        headers = {
            'Content-Type': 'application/json'
        }

        for p in others.keys():
            headers[p] = others[p]
        return headers
241158
def apply_caching(response):
    """"""
    for k, v in config.get('HTTP_HEADERS').items():
        response.headers[k] = v
    return response
803065
def _add_response_info(self):
        """"""
        self.charset = httputil.get_charset(self.headers)
        self.set_content_type()
        self.add_size_info()
60013
def get_headers(self):
        """"""
        headers = {
            "User-Agent": self.http_agent,
            "Content-Type": "application/json",
            "Accept": "application/json"
        }
        if self.headers:
            headers.update(self.headers)

        return headers
221354
def _fetch_headers(self):
    """"""
    self._header_text, self._n_ref = self._read_top_header()
    self._ref_lengths, self._ref_names = self._read_reference_information()
    self._header = SAMHeader(self._header_text)
7603
def on_headers(self, response, exc=None):
        ''''''

        if response.status_code == 101:
            connection = response.connection
            request = response.request
            handler = request.websocket_handler
            if not handler:
                handler = WS()
            parser = request.client.frame_parser(kind=1)
            consumer = partial(WebSocketClient.create,
                               response, handler, parser)
            connection.upgrade(consumer)
            response.event('post_request').fire()
            websocket = connection.current_consumer()
            response.request_again = lambda r: websocket
1138743
def http_headers
      env.select { |k, _v| (k.start_with?("HTTP_") && k != "HTTP_VERSION") || k == "CONTENT_TYPE" }
        .collect { |k, v| [k.sub(/^HTTP_/, ""), v] }
        .collect { |k, v| [k.split("_").collect(&:capitalize).join("-"), v] }
    end
1191641
def head(self, url, headers=None, kwargs=None):
        
        return self._request(
            method='head',
            url=url,
            headers=headers,
            kwargs=kwargs
        )
96921
private void setHeaders(XMLHttpRequest xmlHttpRequest) throws RequestException {

        if ((headers != null) && (headers.size() > 0)) {
            for (Map.Entry<String, String> header : headers.entrySet()) {
                try {
                    xmlHttpRequest.setRequestHeader(header.getKey(), header.getValue());
                } catch (JavaScriptException e) {
                    throw new RequestException(e.getMessage());
                }
            }
        } else {
            xmlHttpRequest.setRequestHeader("Content-Type", "text/plain; charset=utf-8");
        }
    }
87809
def add_headers(self, header_name, value, *values):
		
		if self.__ro_flag:
			raise RuntimeError('ro')
		header_name = self.normalize_name(header_name)
		if header_name not in self.__headers.keys():
			self.__headers[header_name] = [value]
		else:
			self.__headers[header_name].append(value)

		for single_value in values:
			self.__headers[header_name].append(single_value)
724230
def _normalize_django_header_name(header):
        """"""
        # Remove HTTP_ prefix.
        new_header = header.rpartition('HTTP_')[2]
        # Camel case and replace _ with -
        new_header = '-'.join(
            x.capitalize() for x in new_header.split('_'))

        return new_header
511641
def _setHeaders(self, request):
        
        request.responseHeaders.addRawHeader(b'content-type', b'application/json')
        request.responseHeaders.addRawHeader(b'Access-Control-Allow-Origin', b'*')
        request.responseHeaders.addRawHeader(b'Access-Control-Allow-Methods', b'GET, POST, PUT, DELETE')
        request.responseHeaders.addRawHeader(b'Access-Control-Allow-Headers', b'x-prototype-version,x-requested-with')
        request.responseHeaders.addRawHeader(b'Access-Control-Max-Age', 2520)
        return request
989137
def make_auth_headers(self, content_type):
        """"""
        headers = self.make_headers(content_type)
        headers['Authorization'] = 'Basic {}'.format(self.get_auth_string())
        return headers
282164
def fix_django_headers(meta):
	
	ret = {}
	for k, v in meta.items():
		if k.startswith("HTTP_"):
			k = k[len("HTTP_") :]
		elif k not in ("CONTENT_LENGTH", "CONTENT_TYPE"):
			# Skip CGI garbage
			continue

		ret[k.lower().replace("_", "-")] = v

	return ret