示例#1
0
 /**
  * @throws AcceptOn\Error if the response failed (non-2xx response).
  *
  * @return mixed
  */
 private function throwOrReturnResponseBody($body, $statusCode)
 {
     $error = Error::fromResponse($body, $statusCode);
     if (isset($error)) {
         throw $error;
     }
     return json_decode($body);
 }
示例#2
0
 public function testNullForUnknownStatusCode()
 {
     $instance = Error::fromResponse("{}", 999);
     $this->assertNull($instance);
 }