4use InvalidArgumentException;
 
   43        $this->method = strtoupper(
$method);
 
   52        if ($body !== 
'' && $body !== 
null) {
 
   59        if ($this->requestTarget !== 
null) {
 
   63        $target = $this->uri->getPath();
 
   67        if ($this->uri->getQuery() != 
'') {
 
   68            $target .= 
'?' . $this->uri->getQuery();
 
   77            throw new InvalidArgumentException(
 
   78                'Invalid request target provided; cannot contain whitespace' 
  106        if (
$uri === $this->uri) {
 
  113        if (!$preserveHost) {
 
  114            $new->updateHostFromUri();
 
  122        $host = $this->uri->getHost();
 
  128        if (($port = $this->uri->getPort()) !== 
null) {
 
  129            $host .= 
':' . $port;
 
  132        if (isset($this->headerNames[
'host'])) {
 
  133            $header = $this->headerNames[
'host'];
 
  136            $this->headerNames[
'host'] = 
'Host';
 
  140        $this->headers = [
$header => [$host]] + $this->headers;
 
An exception for terminatinating execution or to throw for unit testing.
PSR-7 request implementation.
getRequestTarget()
Retrieves the message's request target.
withUri(UriInterface $uri, $preserveHost=false)
Returns an instance with the provided URI.
getMethod()
Retrieves the HTTP method of the request.
withMethod($method)
Return an instance with the provided HTTP method.
getUri()
Retrieves the URI instance.
__construct( $method, $uri, array $headers=[], $body=null, $version='1.1')
withRequestTarget($requestTarget)
Return an instance with the specific request-target.
PSR-7 URI implementation.
hasHeader($name)
Checks if a header exists by the given case-insensitive name.
Representation of an outgoing, client-side request.
Value object representing a URI.
stream_for($resource='', array $options=[])
Create a new stream based on the input type.
trait MessageTrait
Trait implementing functionality common to requests and responses.
setHeaders(array $headers)