Welcome Guest, Not a member yet? Register   Sign In
RESTful responds and cookies
#1

Is there a way when responding with $this->respond() (RESTful API), to both send a json array and also send a cookie?
For example, if I use $this->response(), I can do

PHP Code:
$this->response->setJSON(['var' => 'value']);

$this->response->setCookie($cookie);

return 
$this->response

is it possible somehow or I can't use RESTful Resource Handling in such cases, I can't find anything about it
Reply
#2

Try
PHP Code:
$this->response->setCookie($cookie);
return 
$this->respond($data200); 
Reply
#3

(04-26-2023, 04:39 AM)kenjis Wrote: Try
PHP Code:
$this->response->setCookie($cookie);
return 
$this->respond($data200); 

It seems to work

Thanks kenjis
Reply




Theme © iAndrew 2016 - Forum software by © MyBB