8000 Don't send multipart POST to non-multipart methods, fix issue #8 · UltraSimplified/codebird-php@74b99ab · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 74b99ab

Browse files
committed
Don't send multipart POST to non-multipart methods, fix issue jublo#8
1 parent 188fac3 commit 74b99ab

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

codebird.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -768,16 +768,16 @@ private function _callApi($httpmethod, $method, $method_template, $params = arra
768768
if (count($params) > 0) {
769769
$url_with_params .= '?' . http_build_query($params);
770770
}
771-
$authorization = $this->_sign('GET', $url, $params);
771+
$authorization = $this->_sign($httpmethod, $url, $params);
772772
$ch = curl_init($url_with_params);
773773
} else {
774-
if ($multipart) {
775-
$authorization = $this->_sign('POST', $url, array());
776-
$post_fields = $params;
777-
} else {
778-
$post_fields = $this->_sign('POST', $url, $params);
774+
$authorization = $this->_sign($httpmethod, $url, array());
775+
if (! $multipart) {
776+
$authorization = $this->_sign($httpmethod, $url, $params);
777+
$params = http_build_query($params);
779778
}
780-
$ch = curl_init($url);
779+
$post_fields = $params;
780+
$ch = curl_init($url);
781781
curl_setopt($ch, CURLOPT_POST, 1);
782782
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
783783
}

0 commit comments

Comments
 (0)
0