Skip to content

Commit 55a4bf4

Browse files
committed
Stopping send headers [] is counts is empty
1 parent 7c63a87 commit 55a4bf4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Request.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,15 @@ public function addHeader(string $name, string $value): self
101101
* */
102102
public function toArray(): array
103103
{
104-
return [
104+
$array = [
105105
'method' => $this->method,
106106
'url' => $this->url,
107-
'header' => $this->headers,
108107
'body' => $this->body,
109108
];
109+
if (count($this->headers) > 0) {
110+
$array['header'] = $this->headers;
111+
}
112+
return $array;
110113
}
111114

112115
/**

0 commit comments

Comments
 (0)