Skip to content

Commit

Permalink
bug fix: query string boolean type to string
Browse files Browse the repository at this point in the history
  • Loading branch information
lanlin committed Sep 21, 2020
1 parent d9c63aa commit 0e352d5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/Authentication/Native.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,10 @@ private function settingsRules(array $params): V
case 'icloud':
case 'hotmail': return $this->knownProviderRule();

case 'imap': return $this->imapProviderRule();

case 'gmail': return $this->gmailProviderRule();

case 'exchange': return $this->exchangeProviderRule();

case 'imap':
default: return $this->imapProviderRule();
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/Request/AbsBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* ----------------------------------------------------------------------------------
*
* @author lanlin
* @change 2020/06/28
* @change 2020/09/21
*/
trait AbsBase
{
Expand Down Expand Up @@ -102,6 +102,8 @@ public function setBody($body) : self
*/
public function setQuery(array $query) : self
{
$query = Helper::boolToString($query);

$this->queryParams = ['query' => $query];

return $this;
Expand Down
24 changes: 23 additions & 1 deletion src/Utilities/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* ----------------------------------------------------------------------------------
*
* @author lanlin
* @change 2020/04/26
* @change 2020/09/21
*/
class Helper
{
Expand Down Expand Up @@ -110,6 +110,28 @@ public static function fooToArray($foo): array

// ------------------------------------------------------------------------------

/**
* convert boolean to string value
*
* @param array $data
*
* @return array
*/
public static function boolToString(array $data): array
{
foreach ($data as $key => $val)
{
if (\is_bool($val))
{
$data[$key] = $val ? 'true' : 'false';
}
}

return $data;
}

// ------------------------------------------------------------------------------

/**
* pickup element from inside array
*
Expand Down

0 comments on commit 0e352d5

Please sign in to comment.