You are here

public function Request::withMethod in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/src/Request.php \GuzzleHttp\Psr7\Request::withMethod()

Return an instance with the provided HTTP method.

While HTTP method names are typically all uppercase characters, HTTP method names are case-sensitive and thus implementations SHOULD NOT modify the given string.

This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that has the changed request method.

Parameters

string $method Case-sensitive method.:

Return value

self

Throws

\InvalidArgumentException for invalid HTTP methods.

Overrides RequestInterface::withMethod

File

vendor/guzzlehttp/psr7/src/Request.php, line 101

Class

Request
PSR-7 request implementation.

Namespace

GuzzleHttp\Psr7

Code

public function withMethod($method) {
  $new = clone $this;
  $new->method = strtoupper($method);
  return $new;
}