Skip to content

Commit d4ac9b0

Browse files
authored
Fixes re-use the PublisherAPI object issue
chapter-three#19
1 parent 248d3cf commit d4ac9b0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/PublisherAPI/Curl.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ protected function response($response) {
120120
* @return object Preprocessed structured object.
121121
*/
122122
public function get($path, Array $path_args = [], Array $data = []) {
123+
$this->setHTTPClient();
123124
parent::get($path, $path_args, $data);
124125
$this->setHeaders(
125126
[
@@ -139,6 +140,7 @@ public function get($path, Array $path_args = [], Array $data = []) {
139140
* @return object Preprocessed structured object and returns 204 No Content on success, with no response body.
140141
*/
141142
public function delete($path, Array $path_args = [], Array $data = []) {
143+
$this->setHTTPClient();
142144
parent::delete($path, $path_args, $data);
143145
$this->setHeaders(
144146
[
@@ -167,6 +169,7 @@ public function delete($path, Array $path_args = [], Array $data = []) {
167169
* @return object Preprocessed structured object.
168170
*/
169171
public function post($path, Array $path_args, Array $data = []) {
172+
$this->setHTTPClient();
170173
parent::post($path, $path_args, $data);
171174

172175
// JSON string to be posted to PublisherAPI instead of article.json file.
@@ -218,8 +221,8 @@ public function post($path, Array $path_args, Array $data = []) {
218221
$info['contents']
219222
);
220223
}
221-
222-
if (!empty($multiparts)) {
224+
225+
if (!empty($multiparts)) {
223226
// Set content type and boundary token.
224227
$content_type = sprintf('multipart/form-data; boundary=%s', $this->boundary);
225228

0 commit comments

Comments
 (0)