Takes the current request and supplements it with the service's defaults
to merge them into a complete request.
550602
protected function supplementRequestWithDefaults()
    {
        // properties to set only if they are empty

        if (empty($this->request->getLocation())) {
            $this->request->setLocation( $this->defaults->getLocation() );
        }

        if (empty($this->request->getMethod())) {
            $this->request->setMethod( $this->defaults->getMethod() );
        }

        if (empty($this->request->getParameters())) {
            $this->request->setParameters( $this->defaults->getParameters() );
        }

        if (empty($this->request->getBody())) {
            $this->request->setBody( $this->defaults->getBody() );
        }

        if (    $this->credentialsAreEmpty($this->request->getCredentials())
            &&  ! $this->credentialsAreEmpty($this->defaults->getCredentials())
        ) {
            $this->request->setCredentials(
                $this->defaults->getCredentials()['name'],
                $this->defaults->getCredentials()['password'],
                $this->defaults->getCredentials()['domain']
            );
        }


        // properties to expand

        if ( ! empty($this->defaults->getHeaders())) {

            $this->request->setHeaders(array_merge(
                $this->request->getHeaders(),
                $this->defaults->getHeaders()
            ));
        }

    }
1338339
def modify_request(self, http_request=None):
    """"""
    if http_request is None:
      http_request = HttpRequest()
    if http_request.uri is None:
      http_request.uri = Uri()
    # Determine the correct scheme.
    if self.scheme:
      http_request.uri.scheme = self.scheme
    if self.port:
      http_request.uri.port = self.port
    if self.host:
      http_request.uri.host = self.host
    # Set the relative uri path
    if self.path:
      http_request.uri.path = self.path
    if self.query:
      http_request.uri.query = self.query.copy()
    return http_request
1210503
def _add_version_to_request(self, url, headers, version):
        """"""
        if self._has_capability(SERVER_REQUIRES_VERSION_HEADER):
            new_headers = headers.copy()
            new_headers['Last-Modified'] = email.utils.formatdate(version)
            return url, new_headers
        else:
            url_params = {
                'last_modified': email.utils.formatdate(version)
            }
            new_url = url + "?" + urlencode(url_params)
            return new_url, headers
695850
def dispatch_request(self, *args, **kwargs):
        """"""
        method = getattr(self, request.method.lower(), None)
        if method is None and request.method == 'HEAD':
            method = getattr(self, 'get', None)
        assert method is not None, 'Unimplemented method {}'.format(request.method)

        headers = {'Content-Type': 'application/vnd.api+json'}

        response = method(*args, **kwargs)

        if isinstance(response, Response):
            response.headers.add('Content-Type', 'application/vnd.api+json')
            return response

        if not isinstance(response, tuple):
            if isinstance(response, dict):
                response.update({'jsonapi': {'version': '1.0'}})
            return make_response(json.dumps(response, cls=JSONEncoder), 200, headers)

        try:
            data, status_code, headers = response
            headers.update({'Content-Type': 'application/vnd.api+json'})
        except ValueError:
            pass

        try:
            data, status_code = response
        except ValueError:
            pass

        if isinstance(data, dict):
            data.update({'jsonapi': {'version': '1.0'}})

        return make_response(json.dumps(data, cls=JSONEncoder), status_code, headers)
1351822
def _request(self, method, url, params, headers, content, form_content):
        # type: (str, str, Optional[Dict[str, str]], Optional[Dict[str, str]], Any, Optional[Dict[str, Any]]) -> ClientRequest
        
        request = ClientRequest(method, self.format_url(url))

        if params:
            request.format_parameters(params)

        if headers:
            request.headers.update(headers)
        # All requests should contain a Accept.
        # This should be done by Autorest, but wasn't in old Autorest
        # Force it for now, but might deprecate it later.
        if "Accept" not in request.headers:
            _LOGGER.debug("Accept header absent and forced to application/json")
            request.headers['Accept'] = 'application/json'

        if content is not None:
            request.add_content(content)

        if form_content:
            request.add_formdata(form_content)

        return request
214229
def process_request(self, unused_request):
    """"""
    # Compare to the first half of toplevel() in context.py.
    tasklets._state.clear_all_pending()
    # Create and install a new context.
    ctx = tasklets.make_default_context()
    tasklets.set_context(ctx)
444776
public static Endpoint merge(Endpoint defaults, Endpoint override) {

        if (defaults == null) {
            defaults = new Endpoint();
        }

        if (override == null) {
            override = new Endpoint();
        }

        final Endpoint merged = new Endpoint();

        merged.setCredentialScope(override.getCredentialScope() != null
                ? override.getCredentialScope()
                : defaults.getCredentialScope());

        merged.setHostName(override.getHostName() != null
                ? override.getHostName()
                : defaults.getHostName());

        merged.setSslCommonName(override.getSslCommonName() != null
                ? override.getSslCommonName()
                : defaults.getSslCommonName());

        merged.setProtocols(override.getProtocols() != null
                ? override.getProtocols()
                : defaults.getProtocols());

        merged.setSignatureVersions(override.getSignatureVersions() != null
                ? override.getSignatureVersions()
                : defaults.getSignatureVersions()
        );

        return merged;

    }
980459
def _merge_data(self, data: AnyMapping, *additional: AnyMapping) -> dict:
        
        """
        return defaults(
            dict(data) if not isinstance(data, dict) else data,
            *(dict(item) for item in additional))
1260537
def modify(self, service_name, json, **kwargs):
        """"""
        return self._send(requests.put, service_name, json, **kwargs)
931480
def add_request(self, request):
        

        queue_item = QueueItem(request, Response(request.url))
        self.add(queue_item)
        return queue_item
1086760
def complete(self, request, response):
        
        extra = self.get_extra_data(response)
        data = {}
        for form_field, backend_field in self.PROFILE_MAPPING.items():
            data[form_field] = self.extract_data(extra, backend_field)
        request.session['extra'] = data

        if settings.ACCEPT_EXTRA_FORM:
            self.fill_extra_fields(request, data)

        request.session['identity'] = self.identity
        return redirect('netauth-extra', self.provider)
867225
def merge_default(defaults)
      if defaults && !defaults.empty?
        defaults.each do |key, value|
          self[key] = value unless self.key?(key)
        end
      end
      self
    end
515101
def complete_request(self, account_id, request_id, **params):
        """"""
        response = self._post(
            'v2', 'accounts', account_id, 'transactions', request_id,
            'complete', data=params)
        return self._make_api_object(response, APIObject)
690323
function RequestWrapper(req) {
  this.request = req;
  this.method = req.method;
  this.url = req.url;
  this.body = req._data;
  this.headers = req._header;
}
1089203
public Spider addRequest(Request... requests) {
        for (Request request : requests) {
            addRequest(request);
        }
        signalNewUrl();
        return this;
    }
118154
def create_request_setting(self,
		service_id,
		version_number,
		name,
		default_host=None,
		force_miss=None,
		force_ssl=None,
		action=None,
		bypass_busy_wait=None,
		max_stale_age=None,
		hash_keys=None,
		xff=None,
		timer_support=None,
		geo_headers=None,
		request_condition=None):
		""""""
		body = self._formdata({
			"name": name,
			"default_host": default_host,
			"force_miss": force_miss,
			"force_ssl": force_ssl,
			"action": action,
			"bypass_busy_wait": bypass_busy_wait,
			"max_stale_age": max_stale_age,
			"hash_keys": hash_keys,
			"xff": xff,
			"timer_support": timer_support,
			"geo_headers": geo_headers,
			"request_condition": request_condition,
		}, FastlyRequestSetting.FIELDS)
		content = self._fetch("/service/%s/version/%d/request_settings" % (service_id, version_number), method="POST", body=body)
		return FastlyRequestSetting(self, content)
513067
def users_me_merge(self, data, **kwargs):
        ""
        api_path = "/api/v2/users/me/merge.json"
        return self.call(api_path, method="PUT", data=data, **kwargs)