Welcome Guest, Not a member yet? Register   Sign In
Cannot access request headers in controller
#1
Question 

Hello. I am just having a hard time working with request headers. I did a custom Controller which extends CodeIgniter\Controller. In the constructor (public function initController(\CodeIgniter\HTTP\RequestInterface $request,.....)  I try using the function $request->getHeader('any-header'); and they always return an empty object. Am I doing something wrong? Using the function $request->headers(); crashes because of error "Call to undefined method", even using $this->request->getHeader("any-header"); 
As a workaround I used php function getallheaders(). I'd like using the codeigniter functions. Any clue to fix this?
Reply


Messages In This Thread
Cannot access request headers in controller - by neojav123 - 12-21-2022, 07:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB