updated-packages
This commit is contained in:
		
							
								
								
									
										16
									
								
								vendor/guzzlehttp/psr7/src/Request.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								vendor/guzzlehttp/psr7/src/Request.php
									
									
									
									
										vendored
									
									
								
							| @@ -1,4 +1,5 @@ | ||||
| <?php | ||||
|  | ||||
| namespace GuzzleHttp\Psr7; | ||||
|  | ||||
| use InvalidArgumentException; | ||||
| @@ -16,7 +17,7 @@ class Request implements RequestInterface | ||||
|     /** @var string */ | ||||
|     private $method; | ||||
|  | ||||
|     /** @var null|string */ | ||||
|     /** @var string|null */ | ||||
|     private $requestTarget; | ||||
|  | ||||
|     /** @var UriInterface */ | ||||
| @@ -26,7 +27,7 @@ class Request implements RequestInterface | ||||
|      * @param string                               $method  HTTP method | ||||
|      * @param string|UriInterface                  $uri     URI | ||||
|      * @param array                                $headers Request headers | ||||
|      * @param string|null|resource|StreamInterface $body    Request body | ||||
|      * @param string|resource|StreamInterface|null $body    Request body | ||||
|      * @param string                               $version Protocol version | ||||
|      */ | ||||
|     public function __construct( | ||||
| @@ -36,6 +37,7 @@ class Request implements RequestInterface | ||||
|         $body = null, | ||||
|         $version = '1.1' | ||||
|     ) { | ||||
|         $this->assertMethod($method); | ||||
|         if (!($uri instanceof UriInterface)) { | ||||
|             $uri = new Uri($uri); | ||||
|         } | ||||
| @@ -50,7 +52,7 @@ class Request implements RequestInterface | ||||
|         } | ||||
|  | ||||
|         if ($body !== '' && $body !== null) { | ||||
|             $this->stream = stream_for($body); | ||||
|             $this->stream = Utils::streamFor($body); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -91,6 +93,7 @@ class Request implements RequestInterface | ||||
|  | ||||
|     public function withMethod($method) | ||||
|     { | ||||
|         $this->assertMethod($method); | ||||
|         $new = clone $this; | ||||
|         $new->method = strtoupper($method); | ||||
|         return $new; | ||||
| @@ -139,4 +142,11 @@ class Request implements RequestInterface | ||||
|         // See: http://tools.ietf.org/html/rfc7230#section-5.4 | ||||
|         $this->headers = [$header => [$host]] + $this->headers; | ||||
|     } | ||||
|  | ||||
|     private function assertMethod($method) | ||||
|     { | ||||
|         if (!is_string($method) || $method === '') { | ||||
|             throw new \InvalidArgumentException('Method must be a non-empty string.'); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 RafficMohammed
					RafficMohammed