Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Request::withMethod() #4112

Merged
merged 1 commit into from
Jan 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions system/HTTP/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class Request extends Message implements MessageInterface, RequestInterface
*/
protected $uri;

//--------------------------------------------------------------------

/**
* Constructor.
*
Expand All @@ -68,8 +66,6 @@ public function __construct($config = null)
}
}

//--------------------------------------------------------------------

/**
* Validate an IP address
*
Expand All @@ -85,8 +81,6 @@ public function isValidIP(string $ip = null, string $which = null): bool
return (new FormatRules())->valid_ip($ip, $which);
}

//--------------------------------------------------------------------

/**
* Get the request method.
*
Expand All @@ -101,8 +95,6 @@ public function getMethod(bool $upper = false): string
return ($upper) ? strtoupper($this->method) : strtolower($this->method);
}

//--------------------------------------------------------------------

/**
* Sets the request method. Used when spoofing the request.
*
Expand All @@ -124,16 +116,16 @@ public function setMethod(string $method)
*
* @param string $method
*
* @return self
* @return static
*/
public function withMethod($method)
{
$clone = clone $this;
$request = clone $this;

return $clone->setMethod($method);
}
$request->method = $method;

//--------------------------------------------------------------------
return $request;
}

/**
* Retrieves the URI instance.
Expand Down