Skip to content

Commit 0ca9cb7

Browse files
authored
Merge pull request #68 from Jhut89/3.1.3
add switch for closing connections
2 parents 3dd46e4 + 77bdd5d commit 0ca9cb7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Requests/MailchimpConnection.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,13 @@ private function setHandlerOptionsForMethod()
179179

180180
/**
181181
* Executes a connection with the current request and settings
182+
*
183+
* @param bool $close close this connection after execution
184+
*
182185
* @return MailchimpResponse
183186
* @throws MailchimpException
184187
*/
185-
public function execute()
188+
public function execute($close = true)
186189
{
187190
$this->response = $this->executeCurl();
188191
if (!$this->response) {
@@ -197,6 +200,10 @@ public function execute()
197200
strlen($this->response)
198201
);
199202

203+
if ($close) {
204+
$this->close();
205+
}
206+
200207
if ($this->isSuccess()) {
201208
return new SuccessResponse(
202209
$this->headers,

0 commit comments

Comments
 (0)