Handler::makeRequest()

@return
962782
protected function makeRequest()
    {
        $requestType = trim(strtolower($this->getService('type')));
        if($this->getService('endpoint'))
            $this->requestUrl->appendPathSegment($this->getEndpoint());
        if($requestType != 'post' && $this->getParam())
            $this->requestUrl->setQueryFromArray($this->getParam());
        $this->requestUrl->setQueryParameter('key',$this->getApiKey());
        switch ($requestType){
            case 'POST':
                $postData = json_encode($this->getParam());
                break;
            case 'GET':
            default:
                break;
        }
        $request        = StreamClient::make()->{$requestType}($this->requestUrl->write());
        $responseBody   = $this->unserializeResponse($request->getBody());
        $responseStatus = $request->getStatusCode();
        switch($responseStatus){
            case 200:
                if($responseBody['status'] != self::STATUS_SUCCESS)
                    throw new \ErrorException($responseBody['status'].':'.$responseBody['error_message']);
                break;
            default:
                throw new \ErrorException($responseStatus.' '.$request->getReasonPhrase().':'.$responseBody['error_message']);
        }
        $checkClass = __NAMESPACE__."\Services\\".ucfirst($this->service);
        $this->responseBody = (Arr::has($responseBody,$this->getService(self::$responseKey))) ? Arr::get($responseBody,$this->getService(self::$responseKey)) : $responseBody;
        return (class_exists($checkClass)) ? new $checkClass($this) : $responseBody;
    }
281399
protected function createHandler()
    {
        $stack = HandlerStack::create();

        $stack->push(Middleware::mapRequest(function (RequestInterface $request) {
            $config = $this->config;

            if ($idempotencykey = $config->getIdempotencyKey()) {
                $request = $request->withHeader('Idempotency-Key', $idempotencykey);
            }

            if ($accountId = $config->getAccountId()) {
                $request = $request->withHeader('Stripe-Account', $accountId);
            }

            $request = $request->withHeader('Stripe-Version', $config->getApiVersion());

            $request = $request->withHeader('User-Agent', 'Cartalyst-Stripe/'.$config->getVersion());

            $request = $request->withHeader('Authorization', 'Basic '.base64_encode($config->getApiKey()));

            return $request;
        }));

        $stack->push(Middleware::retry(function ($retries, RequestInterface $request, ResponseInterface $response = null, TransferException $exception = null) {
            return $retries < 3 && ($exception instanceof ConnectException || ($response && $response->getStatusCode() >= 500));
        }, function ($retries) {
            return (int) pow(2, $retries) * 1000;
        }));

        return $stack;
    }
639990
protected function newRequest()
    {
        $req = new \stdClass;
        $req->attrs = new \stdClass();
        $req->attrs->request = [];
        $req->attrs->get = [];
        $req->attrs->post = [];
        $req->attrs->cookie = [];
        $req->attrs->server = [];
        $req->attrs->files = [];
        $req->attrs->session = null;
        $req->attrs->paramsDone = false;
        $req->attrs->inputDone = false;
        $req->attrs->input = new Input();
        $req->attrs->inputReaded = 0;
        $req->attrs->chunked = false;
        $req->upstream = $this;
        return $req;
    }
886360
protected function createConsoleRequest(): Request
    {
        $requestStack = $this->getRequestStack();
        $request = $requestStack->getCurrentRequest();
        if (!$request instanceof Request) {
            $request = new Request();
            $requestStack->push($request);
        }

        $request->attributes->set('pbjx_console', true);
        $request->attributes->set('pbjx_bind_unrestricted', true);

        return $request;
    }
1017974
protected function createRequest()
    {
        $request = $this->requestFactory->createRequest($this->method, $this->getEndpoint());

        return $this->queryHelper->applyToRequest($request);
    }
6053
public function createRequest() {
        $request = new \Amp\Artax\Request();
        $url = null;
        $request->setMethod('');



        //Parameters are parsed and set, lets prepare the request
        if ($url == null) {
            $url = "https://api.github.com";
        }
        $request->setUri($url);

        return $request;
    }
368582
private function makeHttpRequest()
    {
        try {
            return $this->client->post($this->apiUrl, [
                $this->httpBodyParam => $this->post->toArray(),
            ])->getBody();
        } catch (HttpClientException $e) {
            throw new \Exception($e->getRequest().' '.$e->getResponse());
        } catch (HttpServerException $e) {
            throw new \Exception($e->getRequest().' '.$e->getResponse());
        } catch (HttpBadResponseException $e) {
            throw new \Exception($e->getRequest().' '.$e->getResponse());
        }
    }
552579
protected function buildRequest()
    {
        $request = new Request($this->helper());
        $request->setRouter($this->router());

        return $request;
    }
198566
private function initRequest(): App
    {
        try {
            $request = ServerRequestFactory::fromGlobals();
            $this->containers()->set('request', $request);
        } catch (\InvalidArgumentException $e) {
            new Exception($e);
        }
        return $this;
    }
690038
protected function createRequest(): RequestInterface
    {
        $url = sprintf('%s/%s', $this->baseUrl, $this->getUrl($this->options));

        return new Request($this->getMethod(), $url, $this->getHeaders());
    }
319056
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
	{
		$requestMethod = $request->getMethod();
		$method = $this->getOverrideMethod($requestMethod, $request);

		if (!empty($method) && $method !== $requestMethod) {
			$allowed = $this->getAllowedOverrideMethods($requestMethod);
			if ([] !== $allowed) {
				if (\in_array($method, $allowed, true)) {
					$request = $request->withMethod($method);
				} else {
					return Factory::response(405);
				}
			}
		}

		return $handler->handle($request);
	}
1069762
public function make()
    {
        return new Response($this->code, $this->headers, $this->stream, $this->version);
    }
1182423
public function make()
    {
        return new Request($this->method, $this->target, $this->server, $this->cookies, $this->data, $this->files, $this->queries, $this->attributes, $this->uri, $this->headers, $this->stream, $this->version);
    }
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);
    }
833410
public function createRequest() {
        $request = new \Amp\Artax\Request();
        $url = null;
        $request->setMethod('');


        $jsonParams = [];
        $value = $this->getFilteredParameter('scopes');
        $jsonParams['scopes'] = $value;
        $value = $this->getFilteredParameter('add_scopes');
        $jsonParams['add_scopes'] = $value;
        $value = $this->getFilteredParameter('remove_scopes');
        $jsonParams['remove_scopes'] = $value;
        $value = $this->getFilteredParameter('note');
        $jsonParams['note'] = $value;
        $value = $this->getFilteredParameter('note_url');
        $jsonParams['note_url'] = $value;
        $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/{id}";
        }
        $request->setUri($url);

        return $request;
    }
515627
function createHttpRequest()
    {
        $headers = [
            'User-Agent' => $this->getContext()->getUserAgent(),
            'Content-Type' => 'application/x-www-form-urlencoded'
        ];

        $body = $this->buildQuery($this->getRequestParameters());

        return $this->getContext()->getMessageFactory()->createRequest(
            'POST',
            $this->getEndpoint(),
            $headers,
            $body
        );

        $httpRequest = new Request(
            'POST',
            $this->getEndpoint(),
            $headers,
            $body
        );

        return $httpRequest;
    }
521139
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $route = $this->router->dispatch($request->getMethod(), rawurldecode($request->getUri()->getPath()));

        if ($route[0] === Dispatcher::NOT_FOUND) {
            return $this->createResponse(404);
        }

        if ($route[0] === Dispatcher::METHOD_NOT_ALLOWED) {
            return $this->createResponse(405)->withHeader('Allow', implode(', ', $route[1]));
        }

        foreach ($route[2] as $name => $value) {
            $request = $request->withAttribute($name, $value);
        }

        $request = $this->setHandler($request, $route[1]);

        return $handler->handle($request);
    }