diff --git a/Request.inc.php b/Request.inc.php index 7e838ab..1501ed3 100644 --- a/Request.inc.php +++ b/Request.inc.php @@ -161,6 +161,21 @@ class Request { return $this->uri; } + /** + * Set the method for the request. + * + * @param string $method + * @throws \InvalidArgumentException + */ + public function setMethod($method) { + + if (!is_string($method)) { + throw new \InvalidArgumentException('method must be a string.'); + } + + $this->method = $method; + } + /** * Set the path and pathParts members. * diff --git a/samples/client-side-request-and-response.php b/samples/client-side-request-and-response.php new file mode 100644 index 0000000..5ea6149 --- /dev/null +++ b/samples/client-side-request-and-response.php @@ -0,0 +1,24 @@ +path = 'https://www.google.com/search'; +$rqst->query = array('q' => 'rest api'); + +print $rqst->uri; + + +?> \ No newline at end of file