return $this;
}
+ /**
+ * Returns the current headers
+ *
+ * @return string[][]
+ */
+ public function getHeaders()
+ {
+ return $this->headers;
+ }
+
+ /**
+ * Sets the headers
+ *
+ * Expected format is
+ * [
+ * 'Header1' => ['value1', 'value2', ...],
+ * 'Header2' => ['value3', 'value4', ...],
+ * ...
+ * ]
+ *
+ * @param string[][] $headers
+ * @return $this
+ */
+ public function withHeaders(array $headers)
+ {
+ $this->headers = $headers;
+
+ return $this;
+ }
+
/**
* Adds a value to a header
*
*/
public function setHeader(string $name, string $value)
{
- $this->headers[$name] = [];
- $this->headers[$name][] = $value;
+ $this->headers[$name] = [$value];
return $this;
}