@param string $method
@param string $type
@param string $bucket
@param string $key

@return \GuzzleHttp\Message\RequestInterface
339993
protected function createRequest($method, $type, $bucket, $key)
    {
        $path    = $this->buildPath($type, $bucket, $key);
        $httpReq = $this->client->createRequest($method, $path);

        return $httpReq;
    }
405867
public function getObject($bucket, $key, array $params = [])
    {
        $params['Bucket'] = $bucket;
        $params['Key'] = $key;

        return $this->instance->getObject($params);
    }
151398
public function createRequest(string $method, string $url, $body=null, array $headers=[])
  {
    # Merge Default Headers with user provided headers
    $headers = array_merge(
      [
         'Accept'          => '*/*',
         'Accept-Encoding' => 'gzip, deflate'
      ],
      $headers
    );

    # Create the httpRequest
    $this->httpRequest = new \GuzzleHttp\Psr7\Request( $method, $url, $headers, $body );

    return $this->httpRequest;
  }
775695
public function changeType($bucket, $key, $fileType)
    {
        $resource = \Qiniu\entry($bucket, $key);
        $path = '/chtype/' . $resource . '/type/' . $fileType;
        list(, $error) = $this->rsPost($path);
        return $error;
    }
634827
public function api($endpoint, array $params = [], $method = Method::GET)
    {
        $headers = $this->getApiHeaders();
        $options = $this->prepareOptions($params, $method);
        Method::isMethodSupported($method);
        if ($this->isUsingTokenParam()) {
            $params['oauth2_access_token'] = $this->accessToken->getToken();
        } else {
            $headers['Authorization'] = 'Bearer ' . $this->accessToken->getToken();
        }
        $guzzle = new GuzzleClient([
            'base_uri' => $this->getApiRoot(),
            'headers' => $headers,
        ]);
        if (!empty($params) && Method::GET === $method) {
            $endpoint .= '?' . build_query($params);
        }
        try {
            $response = $guzzle->request($method, $endpoint, $options);
        } catch (RequestException $requestException) {
            throw Exception::fromRequestException($requestException);
        }
        return self::responseToArray($response);
    }
392172
public function create(string $method, string $uri, array $headers = [], $body = null): RequestInterface
    {
        if (!is_array($body)) {
            return $this->getRequestFactory()->createRequest($method, $uri, $headers, $body);
        }

        return $this->getRequestFactory()->createRequest($method, $uri, $headers);
    }
1089165
public function request($method, $scope = null, $data = null)
    {
        if (is_array($scope)) {
            $data = $scope;
            $scope = null;
        }
        $url = $scope ? $this->url.'/'.ltrim($scope, '/') : $this->url;
        $result = self::$client->request($method, $url, $data);
        if (!$scope && $result instanceof Resource) {
            // TODO: how should POST be handled here?
            foreach ($result->data() as $key => $value) {
                self::offsetSet($key, $value);
            }
        }
        return $scope ? $result : $this;
    }
894064
public function getQuery($key = null, $default = null, $type = 'string')
    {
        return $this->request->get($key, $default, $type);
    }
913867
public function request($method, $uri, array $parameters = [])
    {
        return $this->container->get(AdapterInterface::class)
            ->request($method, $uri, $parameters);
    }
1348941
public RequestHeader withMethod(Method method) {
        return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, principal, headers, lowercaseHeaders);
    }
336355
private function _buildRequest($method, $path, $body = null, $contentType = null)
	{
		// copy default headers
		$headers = $this->_headers;

		// add Content-Type header if provided
		if ($contentType)
			$headers []= new HeaderField('Content-Type', $contentType);

		$request = new Request(
			$method,
			$this->_url->getUrlForRelativePath($path),
			$headers,
			$body
		);

		// pass the request through the filter chain
		foreach($this->_filters as $filter)
		{
			$request = $filter->request($request);
		}

		return $request;
	}
833825
protected function sendRequest($method = 'DELETE', string $type, array $params = [])
    {
        $token  = base64_encode("{$this->apiKey}:");
        $client = new Client([
            'base_uri' => self::API_ENDPOINT,
            'headers'  => [
                'Content-Type'  => 'application/json',
                'Authorization' => "Basic {$token}"
            ]
        ]);

        try {

            $uri     = "zones/{$type}/{$this->zoneId}.json";
            $options = (count($params)) ? ['json' => $params] : [];
            $client->request($method, $uri, $options);

        } catch (BadResponseException $e) {

            throw KeycdnApiException::create(
                $e->getRequest(),
                $e->getResponse()
            );
        }

        return true;

    }
448187
public final function withMethod($method): RequestInterface
   {
       if (!is_string($method)
        || !($toUpperMethod = strtoupper((string) $method))
        || $toUpperMethod !== $this->parseMethod($method)) {
           throw new InvalidArgumentException(
               "Can't get instance for method: " . $method . " not supported");
       }
       return $this->with("method", $toUpperMethod);
   }
8245
public function request($key, $type = 'string', $default = null)
    {
        $request = array_merge($this->get, $this->post, $this->cookie, $this->routeParams);
        $value = $default;
        if (isset($request[$key])) {
            $value = $request[$key];
        }
        settype($value, $type);
        return $value;
    }
857782
public static function request($key = null, $type = 'string', $defaultValue = '')
    {
        if (!$key) {
            return array_merge($_GET, $_POST);
        }
        return self::typeConvert(isset($_REQUEST[$key]) ? $_REQUEST[$key] : $defaultValue, $type);
    }
886702
private static function from($type, $key, $default, &$source = null) {

    	if(null === $source) {

	    	if(static :: isMethod($type)) {

	    		$source = [];
	    		static :: parseRawHttpRequest($source);
	    	}
    	}

    	static :: $method = ['method' => $type, 'data' => &$source];

    	if(null !== $key) {
    		return static :: get($key, $default);
    	}

    	return $source;
    }
267105
public function createRequest(string $method, string $uri, array $body = []): RequestInterface
    {
        $request = $this->requestFactory->createRequest($method, $uri)
            ->withHeader('Content-Type', 'application/json')
            ->withHeader('Authorization', 'Token ' . $this->token)
            ->withHeader('X-Secret', $this->secret)
        ;

        if (!empty($body)) {
            $request = $request
                ->withBody($this->streamFactory->createStream(json_encode($body, JSON_UNESCAPED_UNICODE)))
            ;
        }

        return $request;
    }