diff --git a/src/Router.php b/src/Router.php index d40ee99..d005c19 100644 --- a/src/Router.php +++ b/src/Router.php @@ -116,6 +116,8 @@ public function singleRequest($method, $uri, array $data = [], array $headers = // after we've completed our internal request. $currentRequest = $this->request->instance()->duplicate(); + $headers = $this->overrideHeaders($currentRequest->headers->all(), $headers); + if ($this->disableMiddleware) { $this->app->instance('middleware.disable', true); } @@ -141,6 +143,11 @@ public function singleRequest($method, $uri, array $data = [], array $headers = return $response; } + private function overrideHeaders(array $default, array $headers) + { + return array_merge($default, $headers); + } + public function enableMiddleware() { $this->disableMiddleware = false;