public function withMethod($method)
    {
        $method = strtoupper($method);
        $knownMethods = [
            'HEAD', 'OPTIONS', 'GET', 'POST', 'PUT',
            'DELETE', 'CONNECT', 'TRACE', 'PATCH', 'PURGE'
        ];

        if (! in_array($method, $knownMethods)) {
            throw new InvalidArgumentException(
                "Invalid or unknown method name."
            );
        }

        $message = clone $this;
        $message->method = $method;
        return $message;
    }