Welcome Guest, Not a member yet? Register   Sign In
Services::negotiator -> gzip -> ob_gzhandler
#1

Good day

can somebody please tell me what is best practice to seng a gzipped stream back to client via CI4 ?\
I have the following logic todo this before a JSON string gets send back


PHP Code:
$negotiate = \Config\Services::negotiator();
$type $negotiate->encoding(['gzip']);
  if ($type == 'gzip') {
    ob_start('ob_gzhandler');
  }


//then return the json string
return $this->respondCreated($DummyDataArray); 

Is this the correct way ?
Thank you
Johannes
Reply




Theme © iAndrew 2016 - Forum software by © MyBB