fix hooks
[pharext/pharext.org] / app / Github / API / Hooks / CreateHook.php
index 325dca7fc32528a4e435724c4e7eea7a53bed0d4..866e93964236bdd12bccdb95c2025d5db3368553 100644 (file)
@@ -15,7 +15,8 @@ class CreateHook extends Call
                        "Accept" => $this->config->api->accept,
                        "Content-Type" => "application/json",
                ]);
-               
+
+               $events = [];
                if (!empty($this->args["conf"]["tag"])) {
                        $events[] = "create";
                }
@@ -35,7 +36,7 @@ class CreateHook extends Call
                ]));
                
                $this->api->getClient()->enqueue($request, function($response) use($callback) {
-                       if ($response->getReesponseCode() != 400 || null === ($json = json_decode($response->getBody()))) {
+                       if ($response->getResponseCode() >= 400 || null === ($json = json_decode($response->getBody()))) {
                                throw new RequestException($response);
                        }
                        $callback($json);