Create HttpClient.php

This commit is contained in:
Tony Roy 2021-03-12 14:19:00 -04:00 committed by GitHub
commit ed5e198b31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,7 +40,7 @@ class HttpClient implements HttpClientInterface
* @return mixed * @return mixed
* @throws \GuzzleHttp\Exception\GuzzleException * @throws \GuzzleHttp\Exception\GuzzleException
*/ */
public function get($path, $body = []) public function get($path="", $body = [])
{ {
return $this->request($path, $body, 'GET'); return $this->request($path, $body, 'GET');
} }
@ -50,7 +50,7 @@ class HttpClient implements HttpClientInterface
* @return mixed * @return mixed
* @throws \GuzzleHttp\Exception\GuzzleException * @throws \GuzzleHttp\Exception\GuzzleException
*/ */
public function post($path, $body = []) public function post($path="", $body = [])
{ {
return $this->request($path, $body, 'POST'); return $this->request($path, $body, 'POST');
} }
@ -60,7 +60,7 @@ class HttpClient implements HttpClientInterface
* @return mixed * @return mixed
* @throws \GuzzleHttp\Exception\GuzzleException * @throws \GuzzleHttp\Exception\GuzzleException
*/ */
public function put($path, $body = []) public function put($path="", $body = [])
{ {
return $this->request($path, $body, 'PUT'); return $this->request($path, $body, 'PUT');
} }
@ -70,7 +70,7 @@ class HttpClient implements HttpClientInterface
* @return mixed * @return mixed
* @throws \GuzzleHttp\Exception\GuzzleException * @throws \GuzzleHttp\Exception\GuzzleException
*/ */
public function delete($path, $body = []) public function delete($path="", $body = [])
{ {
return $this->request($path, $body, 'DELETE'); return $this->request($path, $body, 'DELETE');
} }
@ -81,7 +81,7 @@ class HttpClient implements HttpClientInterface
* @return mixed * @return mixed
* @throws \GuzzleHttp\Exception\GuzzleException * @throws \GuzzleHttp\Exception\GuzzleException
*/ */
public function request($path, $body, $method) public function request($path="", $body, $method)
{ {
$response = $this->getClient()->request( $response = $this->getClient()->request(
$method, $method,