Creates Request.
@param  object $req Request.
@param  object $upstream Upstream application instance.
@return object           Request.
427835
public function beginRequest($req, $upstream)
    {
        $e = array_map('rawurldecode', explode('/', $req->attrs->server['DOCUMENT_URI']));

        $serverId = null;
        $sessId = null;

        /* Route discovery */
        $path = null;
        $extra = [];
        do {
            foreach ($this->wss as $wss) {
                $try = implode('/', $e);
                if ($try === '') {
                    $try = '/';
                }
                if ($wss->routeExists($try)) {
                    $path = $try;
                    break 2;
                }
            }
            array_unshift($extra, array_pop($e));
        } while (sizeof($e) > 0);

        if ($path === null) {
            return $this->callMethod('NotFound', $req, $upstream);
        }

        if (sizeof($extra) > 0 && end($extra) === '') {
            array_pop($extra);
        }

        $method = sizeof($extra) ? array_pop($extra) : null;

        if ($method === null) {
            $method = 'Welcome';
        } elseif ($method === 'info') {
        } elseif (preg_match('~^iframe(?:-([^/]*))?\.html$~', $method, $m)) {
            $method = 'Iframe';
            $version = isset($m[1]) ? $m[1] : null;
        } else {
            if (sizeof($extra) < 2) {
                return $this->callMethod('NotFound', $req, $upstream);
            }
            $sessId = array_pop($extra);
            $serverId = array_pop($extra);
            if ($sessId === '' || $serverId === '' || mb_orig_strpos($sessId,
                    '.') !== false || mb_orig_strpos($serverId, '.') !== false
            ) {
                return $this->callMethod('NotFound', $req, $upstream);
            }
        }
        $req->attrs->sessId = $sessId;
        $req->attrs->serverId = $serverId;
        $req->attrs->path = $path;
        $req = $this->callMethod($method, $req, $upstream);
        if ($req instanceof Methods\Iframe && mb_orig_strlen($version)) {
            $req->attrs->version = $version;
        }
        return $req;
    }
771794
protected function createRequest()
    {
        if (!$this->requestPrototype) {
            $request = new HTTP_Request2($this->url);
        } else {
            $request = clone $this->requestPrototype;
            $request->setUrl($this->url);
        }

        foreach (array_keys($this->getProject()->getProperties()) as $propName) {
            if (0 === strpos($propName, 'phing.http.')) {
                $request->setConfig(substr($propName, 11), $this->getProject()->getProperty($propName));
            }
        }

        // set the authentication data
        if (!empty($this->authUser)) {
            $request->setAuth(
                $this->authUser,
                $this->authPassword,
                $this->authScheme
            );
        }

        foreach ($this->configData as $config) {
            $request->setConfig($config->getName(), $config->getValue());
        }

        foreach ($this->headers as $header) {
            $request->setHeader($header->getName(), $header->getValue());
        }

        return $request;
    }
434649
private function createHttpRequest(GetRequest $getRequest)
    {
        $request = $this->createRequest('GET', $getRequest->type, $getRequest->bucket);

        $request->setHeader('Accept', 'application/json');

        return $request;
    }
92181
private function createHttpRequest(PutIndexRequest $getRequest)
    {
        $request = $this->createIndexRequest('PUT', $getRequest->name);
        $data    = array_filter([
            'n_val'  => $getRequest->nVal,
            'schema' => $getRequest->schema,
        ]);

        $request->setBody(Stream::factory(json_encode($data)));
        $request->setHeader('Content-Type', 'application/json');
        $request->setHeader('Accept', 'application/json');

        return $request;
    }
483975
public function createPaymentRequest($customerExtId, $amount, $description, $operative, $service)
    {
        return $this->createRequest('POST', '/payment', [
            'customer_ext_id' => (string) $customerExtId,
            'amount' => $amount,
            'operative' => $operative,
            'service' => $service,
            'description' => $description,
        ]);
    }
381808
private function createRpbMessage(GetRequest $request)
    {
        $rpbGetReq = new RpbGetBucketReq();

        $rpbGetReq->setBucket($request->bucket);
        $rpbGetReq->setType($request->type);

        return $rpbGetReq;
    }
586652
protected function _buildRequest()
    {
        $this->_request = $this->_factory
            ->getNewCancelBuildRequest($this->_api, $this->_order)
            ->build();
        return $this;
    }
651161
def execute(self):
        """"""
        try:
            if self.upstream:
                if self.options['listings'] is True:
                    listing.upload(self.client, self.source_directory)
                    self.client.commit()
                if self.options['images'] is True:
                    image.upload(self.client, self.source_directory)
                    self.client.commit()
                if self.options['inapp'] is True:
                    inapp_product.upload(self.client, self.source_directory)
            else:
                if self.options['listings'] is True:
                    listing.download(self.client, self.source_directory)
                if self.options['images'] is True:
                    image.download(self.client, self.source_directory)
                if self.options['inapp'] is True:
                    inapp_product.download(self.client, self.source_directory)

        except client.AccessTokenRefreshError:
            print(
                'The credentials have been revoked or expired, please re-run'
                'the application to re-authorize')
1288539
function(path, fn, upstream, binds) {
		this.assertNotDestroyed('subscribe', path);
		path = parsePath(path);

		if (path[path.length - 1] === '*')
			throw new Error('no more * subscribe allowed - use upstreams instead : ' + path.join('.'));

		var space;
		switch (path[0]) {
			case '$this':
				space = this.map;
				break;
			case '$env':
				return this.env.subscribe(path.slice(1), fn, upstream, binds);
			case '$parent':
				this.assertHasParent(path);
				return this.parent.subscribe(path.slice(1), fn, upstream, binds);
			default:
				space = utils.getProp(this.map, path);
		}
		if (upstream) {
			if (!space)
				utils.setProp(this.map, path, {
					_upstreams: [fn]
				});
			else
				(space._upstreams = space._upstreams || []).push(fn);
		} else if (!space)
			utils.setProp(this.map, path, {
				_listeners: [fn]
			});
		else
			(space._listeners = space._listeners || []).push(fn);
		if (binds)
			binds.push(unsub(this, path, fn, upstream));
		return this;
	}
408375
def upstream(self):
        
        cmd = ["git", "remote", "get-url", "upstream"]
        try:
            subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
        except subprocess.CalledProcessError:
            return "origin"
        return "upstream"
727737
def start_response_callback(start_response, transaction_id):
        """"""
        def callback(status, headers, exc_info=None):
            """Add our headers to response using a closure."""
            headers.append(('X-Transaction-Id', transaction_id))
            # Call upstream start_response
            start_response(status, headers, exc_info)
        return callback
1097698
public static function fromRawSource(): Request
    {
        if (isset($_SERVER['REQUEST_METHOD'])
                && strtoupper(trim($_SERVER['REQUEST_METHOD'])) === Http::POST) {
            $params = $_POST;
        } else {
            $params = $_GET;
        }

        return new self($params, $_SERVER, $_COOKIE);
    }
514321
protected function createRequest( \Illuminate\Http\Request $nativeRequest )
	{
		$files = ServerRequestFactory::normalizeFiles( $this->getFiles( $nativeRequest->files->all() ) );
		$server = ServerRequestFactory::normalizeServer( $nativeRequest->server->all() );
		$headers = $nativeRequest->headers->all();
		$cookies = $nativeRequest->cookies->all();
		$post = $nativeRequest->request->all();
		$query = $nativeRequest->query->all();
		$method = $nativeRequest->getMethod();
		$uri = $nativeRequest->getUri();

		$body = new Stream( 'php://temp', 'wb+' );
		$body->write( $nativeRequest->getContent() );

		$request = new ServerRequest( $server, $files, $uri, $method, $body, $headers, $cookies, $query, $post );

		foreach( $nativeRequest->attributes->all() as $key => $value ) {
			$request = $request->withAttribute( $key, $value );
		}

		return $request;
	}
893396
public function createRequest() {
        $request = new \Amp\Artax\Request();
        $url = null;
        $request->setMethod('POST');


        $jsonParams = [];
        if (array_key_exists('Accept', $this->parameters) == true) {
        $value = $this->getFilteredParameter('Accept');
            $request->setHeader('Accept', $value);
        }
        $value = $this->getFilteredParameter('userAgent');
        $request->setHeader('User-Agent', $value);
        $value = $this->getFilteredParameter('Authorization');
        $request->setHeader('Authorization', $value);
        if (array_key_exists('otp', $this->parameters) == true) {
        $value = $this->getFilteredParameter('otp');
            $request->setHeader('X-GitHub-OTP', $value);
        }
        $value = $this->getFilteredParameter('scopes');
        $jsonParams['scopes'] = $value;
        $value = $this->getFilteredParameter('note');
        $jsonParams['note'] = $value;
        if (array_key_exists('note_url', $this->parameters) == true) {
        $value = $this->getFilteredParameter('note_url');
            $jsonParams['note_url'] = $value;
        }
        if (array_key_exists('client_id', $this->parameters) == true) {
        $value = $this->getFilteredParameter('client_id');
            $jsonParams['client_id'] = $value;
        }
        if (array_key_exists('client_secret', $this->parameters) == true) {
        $value = $this->getFilteredParameter('client_secret');
            $jsonParams['client_secret'] = $value;
        }
        if (array_key_exists('fingerprint', $this->parameters) == true) {
        $value = $this->getFilteredParameter('fingerprint');
            $jsonParams['fingerprint'] = $value;
        }

        //Parameters are parsed and set, lets prepare the request
        if (count($jsonParams)) {
            $jsonBody = json_encode($jsonParams);
            $request->setHeader("Content-Type", "application/json");
            $request->setBody($jsonBody);
        }
        if ($url == null) {
            $url = "https://api.github.com/authorizations";
        }
        $request->setUri($url);

        return $request;
    }
1125723
private function createHttpRequest(GetIndexRequest $getRequest)
    {
        $resquest = $this->createIndexRequest('GET', $getRequest->name);

        $resquest->setHeader('Accept', 'application/json');

        return $resquest;
    }
725965
private function createRequest(InternalRequestInterface $internalRequest)
    {
        return new Request(
            $internalRequest->getMethod(),
            $internalRequest->getUri(),
            $this->prepareHeaders($internalRequest),
            $this->prepareBody($internalRequest),
            $internalRequest->getProtocolVersion()
        );
    }
902885
def pre_request(self, response, exc=None):
        
        if response.request.method == 'CONNECT':
            self.start_response(
                '200 Connection established',
                [('content-length', '0')]
            )
            # send empty byte so that headers are sent
            self.future.set_result([b''])
            # proxy - server connection
            upstream = response.connection
            # client - proxy connection
            dostream = self.connection
            # Upgrade downstream connection
            dostream.upgrade(partial(StreamTunnel.create, upstream))
            #
            # upstream upgrade
            upstream.upgrade(partial(StreamTunnel.create, dostream))
            response.fire_event('post_request')
            # abort the event
            raise AbortEvent
        else:
            response.event('data_processed').bind(self.data_processed)
            response.event('post_request').bind(self.post_request)