Override to specify HTTP request headers.
183963
public Map<String,String> getRequestHeaders() {

        // If we already set the headers when logging request metadata, use them
        if (super.getRequestHeaders() != null)
            return super.getRequestHeaders();

        try {
            Map<String,String> headers = null;
            String headersVar = getAttributeValueSmart(HEADERS_VARIABLE);
            if (headersVar != null) {
                Process processVO = getProcessDefinition();
                Variable variableVO = processVO.getVariable(headersVar);
                if (variableVO == null)
                    throw new ActivityException("Headers variable '" + headersVar + "' is not defined for process " + processVO.getLabel());
                if (!variableVO.getType().startsWith("java.util.Map"))
                    throw new ActivityException("Headers variable '" + headersVar + "' must be of type java.util.Map");
                Object headersObj = getVariableValue(headersVar);
                if (headersObj != null) {
                    headers = new HashMap<>();
                    for (Object key : ((Map<?,?>)headersObj).keySet()) {
                        headers.put(key.toString(), ((Map<?,?>)headersObj).get(key).toString());
                    }
                }
            }
            Object authProvider = getAuthProvider();
            if (authProvider instanceof AuthTokenProvider) {
                if (headers == null)
                    headers = new HashMap<>();
                URL endpoint = new URL(getEndpointUri());
                String user = getAttribute(AUTH_USER);
                String password = getAttribute(AUTH_PASSWORD);
                String appId = getAttribute(AUTH_APP_ID);
                if (appId != null && appId.length() > 0) {
                    Map<String,String> options = new HashMap<>();
                    options.put("appId", appId);
                    ((AuthTokenProvider) authProvider).setOptions(options);
                }
                String token = new String(((AuthTokenProvider)authProvider).getToken(endpoint, user, password));
                headers.put("Authorization", "Bearer " + token);
            }
            // Set the headers so that we don't try and set them next time this method gets called
            super.setRequestHeaders(headers);
            return headers;
        }
        catch (Exception ex) {
            logger.severeException(ex.getMessage(), ex);
            return null;
        }
    }
544801
def set_headers(self):
        
        self.set_header("Accept-Ranges", "bytes")

        content_type = self.get_content_type()
        if content_type:
            self.set_header("Content-Type", content_type)
436171
public PactDslRequestWithPath headers(Map<String, String> headers) {
      for (Map.Entry<String, String> entry: headers.entrySet()) {
        requestHeaders.put(entry.getKey(), Collections.singletonList(entry.getValue()));
      }
      return this;
    }
711151
def head(self, url, **kwargs):
        
        """

        kwargs.setdefault('allow_redirects', False)
        return self.request('HEAD', url, **kwargs)
1252133
function setHeaders(req, headers) {
        var i;
        for (i = 0; i < headers.length; ++i) {
            req.setRequestHeader(headers[i][0], headers[i][1]);
        }
    }
568796
def required_header(header):
    
    if header in IGNORE_HEADERS:
        return False

    if header.startswith('HTTP_') or header == 'CONTENT_TYPE':
        return True

    return False
117749
private void setUpgradeRequestHeaders(ChannelHandlerContext ctx, HttpRequest request) {
        // Set the UPGRADE header on the request.
        request.headers().set(HttpHeaderNames.UPGRADE, upgradeCodec.protocol());

        // Add all protocol-specific headers to the request.
        Set<CharSequence> connectionParts = new LinkedHashSet<CharSequence>(2);
        connectionParts.addAll(upgradeCodec.setUpgradeHeaders(ctx, request));

        // Set the CONNECTION header from the set of all protocol-specific headers that were added.
        StringBuilder builder = new StringBuilder();
        for (CharSequence part : connectionParts) {
            builder.append(part);
            builder.append(',');
        }
        builder.append(HttpHeaderValues.UPGRADE);
        request.headers().add(HttpHeaderNames.CONNECTION, builder.toString());
    }
425678
public B setHttpHeaders(Headers<AsciiString, String, ?> httpHeaders) {
        requireNonNull(httpHeaders, "httpHeaders");
        this.httpHeaders.setAll(httpHeaders);
        return self();
    }
994624
def add_cors_headers(request, response):
    """"""
    response.headerlist.append(('Access-Control-Allow-Origin', '*'))
    response.headerlist.append(
        ('Access-Control-Allow-Methods', 'GET, OPTIONS'))
    response.headerlist.append(
        ('Access-Control-Allow-Headers',
         ','.join(DEFAULT_ACCESS_CONTROL_ALLOW_HEADERS)))
865338
function setRequestHeaders(connection, req) {
  if(_.isObject(connection.headers)){
    req.set(connection.headers);
  }
}
894575
protected function supplementRequestWithDefaults()
    {
        parent::supplementRequestWithDefaults();

        // set the HTTP Method if it is set in the defaults
        if (empty($this->request->getHttpMethod()) && ! empty($this->defaults['http_method'])) {

            $this->request->setHttpMethod( $this->defaults['http_method'] );
        }
    }
192426
def request(self, uri, method, *args, **kwargs):
        
        if self.timeout:
            kwargs["timeout"] = self.timeout
        kwargs["verify"] = self.verify_ssl
        kwargs.setdefault("headers", kwargs.get("headers", {}))
        kwargs["headers"]["User-Agent"] = self.user_agent
        kwargs["headers"]["Accept"] = "application/json"
        if ("body" in kwargs) or ("data" in kwargs):
            if "Content-Type" not in kwargs["headers"]:
                kwargs["headers"]["Content-Type"] = "application/json"
            elif kwargs["headers"]["Content-Type"] is None:
                del kwargs["headers"]["Content-Type"]
        # Allow subclasses to add their own headers
        self._add_custom_headers(kwargs["headers"])
        resp, body = pyrax.http.request(method, uri, *args, **kwargs)
        if resp.status_code >= 400:
            raise exc.from_response(resp, body)
        return resp, body
1146254
def request_headers(self):
        '''
        '''
        headers = CIMultiDict()
        for k in self.environ:
            if k.startswith('HTTP_'):
                head = k[5:].replace('_', '-')
                headers[head] = self.environ[k]
        for head in ENVIRON_HEADERS:
            k = head.replace('-', '_').upper()
            v = self.environ.get(k)
            if v:
                headers[head] = v
        for middleware in self.wsgi.headers_middleware:
            middleware(self.environ, headers)
        return headers
1094081
def ProcessHttpRequest(self, http_request):
        """"""
        http_request.headers.update(self.additional_http_headers)
        if self.log_request:
            logging.info('Making http %s to %s',
                         http_request.http_method, http_request.url)
            logging.info('Headers: %s', pprint.pformat(http_request.headers))
            if http_request.body:
                # TODO(craigcitro): Make this safe to print in the case of
                # non-printable body characters.
                logging.info('Body:\n%s',
                             http_request.loggable_body or http_request.body)
            else:
                logging.info('Body: (none)')
        return http_request
799677
def _request(self, http_method, relative_url='', **kwargs):
        """"""
        # It could be possible to call api.resource.get('/index')
        # but it would be non-intuitive that the path would resolve
        # to root of domain
        relative_url = self._remove_leading_slash(relative_url)

        # Add default kwargs with possible custom kwargs returned by
        # before_request
        new_kwargs = self.default_kwargs().copy()
        custom_kwargs = self.before_request(
            http_method,
            relative_url,
            kwargs.copy()
        )
        new_kwargs.update(custom_kwargs)

        response = requests.request(
            http_method,
            self._join_url(relative_url),
            **new_kwargs
        )

        return self.after_request(response)
810552
def http(self, *args, **kwargs):
        """"""
        kwargs['api'] = self.api
        return http(*args, **kwargs)
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);
        }
    });

}