Skip to content

Commit e1d44b5

Browse files
author
bilovol
committed
add response headers
1 parent 778ab1f commit e1d44b5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ApiClient.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected function sendRequest($path, $method = 'GET', $data = array(), $useToke
110110
$curl = curl_init();
111111

112112
if ($useToken && !empty($this->token)) {
113-
$headers = array('Authorization: Bearer ' . $this->token);
113+
$headers = array('Authorization: Bearer ' . $this->token, 'Expect:');
114114
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
115115
}
116116

@@ -145,6 +145,7 @@ protected function sendRequest($path, $method = 'GET', $data = array(), $useToke
145145
$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
146146
$headerCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
147147
$responseBody = substr($response, $header_size);
148+
$responseHeaders = substr($response, 0, $header_size);
148149

149150
curl_close($curl);
150151

@@ -156,6 +157,7 @@ protected function sendRequest($path, $method = 'GET', $data = array(), $useToke
156157
$retval = new stdClass();
157158
$retval->data = json_decode($responseBody);
158159
$retval->http_code = $headerCode;
160+
$retval->headers = $responseHeaders;
159161
}
160162

161163
return $retval;
@@ -176,6 +178,7 @@ protected function handleResult($data)
176178
if ($data->http_code !== 200) {
177179
$data->data->is_error = true;
178180
$data->data->http_code = $data->http_code;
181+
$data->data->headers = $data->headers;
179182
}
180183

181184
return $data->data;
@@ -1590,4 +1593,4 @@ public function deleteSmsCampaign($campaignID)
15901593

15911594
return $this->handleResult($requestResult);
15921595
}
1593-
}
1596+
}

0 commit comments

Comments
 (0)