bug fix for post (model) and update php test cases

This commit is contained in:
wing328
2015-04-17 20:01:58 +08:00
parent cbbe29cf70
commit 7e37f3294a
9 changed files with 241 additions and 110 deletions

View File

@@ -94,7 +94,11 @@ class APIClient {
$headers[] = $this->headerName . ": " . $this->headerValue;
}
if ((isset($headerName['Content-Type']) and strpos($headerName['Content-Type'], "multipart/form-data") === FALSE) and (is_object($postData) or is_array($postData))) {
// form data
if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) {
$postData = http_build_query($postData);
}
else if ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model
$postData = json_encode($this->sanitizeForSerialization($postData));
}