Esempio n. 1
0
 /**
  * Make a cURL request
  *
  * @param string $method
  * @param null $uri
  * @param array $options
  * @param Client|null $client
  *
  * @return mixed|void
  *
  * @throws \GitAbstraction\Core\Exception\InvalidJSONException
  * @throws \BadMethodCallException
  * @throws \InvalidArgumentException
  */
 public function make($method = 'GET', $uri = null, $options = [], Client $client = null)
 {
     if ($uri !== null) {
         $client = $client ?: new Client();
         try {
             $request = $client->request($method, $uri, $options);
             return Response::respond($request->getBody()->getContents());
         } catch (ClientException $e) {
             return;
         }
     } else {
         throw new \BadMethodCallException("URI was not provided");
     }
 }
Esempio n. 2
0
 /**
  * @expectedException \GitAbstraction\Core\Exception\InvalidJSONException
  */
 public function testInvalidJson()
 {
     Response::respond('{');
 }