Skip to content

Commit

Permalink
Merge pull request #75 from hborras/temp-v6
Browse files Browse the repository at this point in the history
Temp v6
  • Loading branch information
hborras authored Mar 6, 2020
2 parents 3dcb54d + 1c69f68 commit 7abbf41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public static function fromConsumerAndToken(
$defaults['oauth_token'] = $token->key;
}

if (isset($parameters['batch'])) {
$parameters = array_merge($defaults, ['oauth_body_hash' => base64_encode(sha1($parameters['batch'], true))]);
} elseif (isset($parameters['raw'])) {
if (isset($parameters['raw'])) {
$parameters = array_merge($defaults, ['oauth_body_hash' => base64_encode(sha1($parameters['raw'], true))]);
} elseif (empty($parameters)) {
$parameters = array_merge($defaults, ['oauth_body_hash' => base64_encode(sha1('', true))]);
Expand Down
6 changes: 4 additions & 2 deletions src/TwitterAds.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,10 @@ private function request($url, $method, $authorization, $postfields, $headers =
$options[CURLOPT_POST] = true;
if (isset($postfields['raw'])) {
$options[CURLOPT_POSTFIELDS] = $postfields['raw'];
} else if (isset($postfields['batch'])) {
$options[CURLOPT_POSTFIELDS] = $postfields['batch'];
$options[CURLOPT_HTTPHEADER] = array_merge($options[CURLOPT_HTTPHEADER], [
'Content-Type: application/json',
'Content-Length: '. strlen($postfields['raw'])
]);
} else {
$options[CURLOPT_POSTFIELDS] = Util::buildHttpQuery($postfields);
}
Expand Down

0 comments on commit 7abbf41

Please sign in to comment.