/** * Build the header context for the request. * * Creates cookies & headers. * * @param \Cake\Network\Http\Request $request The request being sent. * @param array $options Array of options to use. * @return void */ protected function _buildHeaders(Request $request, $options) { $headers = []; foreach ($request->headers() as $name => $value) { $headers[] = "{$name}: {$value}"; } $cookies = []; foreach ($request->cookies() as $name => $value) { $cookies[] = "{$name}={$value}"; } if ($cookies) { $headers[] = 'Cookie: ' . implode('; ', $cookies); } $this->_contextOptions['header'] = implode("\r\n", $headers); }