| @@ 81-96 (lines=16) @@ | ||
| 78 | /** | |
| 79 |      * {@inheritdoc} | |
| 80 | */ | |
| 81 | public function put($url, $content = '') | |
| 82 |     { | |
| 83 | $request = $this->client->put($url); | |
| 84 |         if (is_array($content)) { | |
| 85 | $request->setBody(json_encode($content), 'application/json'); | |
| 86 |         } else { | |
| 87 | $request->setBody($content); | |
| 88 | } | |
| 89 |         try { | |
| 90 | $this->response = $request->send(); | |
| 91 |         } catch (RequestException $e) { | |
| 92 | $this->response = $e->getResponse(); | |
| 93 | $this->handleError(); | |
| 94 | } | |
| 95 | return $this->response->getBody(true); | |
| 96 | } | |
| 97 | ||
| 98 | /** | |
| 99 |      * {@inheritdoc} | |
| @@ 101-116 (lines=16) @@ | ||
| 98 | /** | |
| 99 |      * {@inheritdoc} | |
| 100 | */ | |
| 101 | public function post($url, $content = '') | |
| 102 |     { | |
| 103 | $request = $this->client->post($url); | |
| 104 |         if (is_array($content)) { | |
| 105 | $request->setBody(json_encode($content), 'application/json'); | |
| 106 |         } else { | |
| 107 | $request->setBody($content); | |
| 108 | } | |
| 109 |         try { | |
| 110 | $this->response = $request->send(); | |
| 111 |         } catch (RequestException $e) { | |
| 112 | $this->response = $e->getResponse(); | |
| 113 | $this->handleError(); | |
| 114 | } | |
| 115 | return $this->response->getBody(true); | |
| 116 | } | |
| 117 | ||
| 118 | /** | |
| 119 |      * {@inheritdoc} | |