Skip to content

Commit 51958af

Browse files
committed
json-encoded array support for addQuery
1 parent 1e8c90d commit 51958af

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Discord/EndpointTrait.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public function bindAssoc(array $args): self
5050
public function addQuery(string $key, $value): void
5151
{
5252
if (! is_bool($value)) {
53-
$value = (string) $value;
53+
$value = is_array($value)
54+
? (json_encode($value) ?: throw new \InvalidArgumentException('Invalid JSON'))
55+
: (string) $value;
5456
}
5557

5658
$this->query[$key] = $value;

0 commit comments

Comments
 (0)