You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
No default HTTP protocol version is set when you create a new response object with
$request = new Response( \Config\App() );
CodeIgniter 4 version
4.0.0-rc3
Affected module(s)
HTTP\Response
Expected behavior
A default HTTP protocol version is set and outputted
Output:
HTTP/1.1 200 Found <rest of response>
Currently it outputs:
HTTP/ 200 Found <rest of response>
Reproduce
Create your own filter
<?php namespace App\Filters;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\Response;
class My_Filter_Name implements FilterInterface
{
function before( RequestInterface $request )
{
// sends a response because it does not like the json provided for example
$response = new Response( \Config\App() );
$response->setHeader('X-Framework', 'CI4');
return $response;
}
function after( RequestInterface $request, ResponseInterface $response ) {return;}
}
Create alias and add it to an route
Invoke filter by opening the route in the browser
You get the raw data string from the server; beginning with
HTTP/ 200 Found
Host: localhost:8080
Date: Sat, 02 Nov 2019 17:34:58 GMT
........
Workaround
set the protocol version in your filter: $response->setProtocolVersion(1.1);
Fix/Patch
A fix is pretty simple, by editing the following line:
Describe the bug
No default HTTP protocol version is set when you create a new response object with
$request = new Response( \Config\App() );
CodeIgniter 4 version
4.0.0-rc3
Affected module(s)
HTTP\Response
Expected behavior
A default HTTP protocol version is set and outputted
Reproduce
Create alias and add it to an route
Invoke filter by opening the route in the browser
You get the raw data string from the server; beginning with
Workaround
set the protocol version in your filter:
$response->setProtocolVersion(1.1);
Fix/Patch
A fix is pretty simple, by editing the following line:
CodeIgniter4/system/HTTP/Response.php
Line 722 in c20b7d7
Replace
$this->protocolVersion
with
$this->getProtocolVersion()
The getProtocolVersion() function defaults to 1.1
CodeIgniter4/system/HTTP/Message.php
Line 351 in c20b7d7
Context
The text was updated successfully, but these errors were encountered: