Beispiel #1
0
 /**
  * Prepare the response to ready to send to client.
  */
 public function prepare()
 {
     if (!$this->prepared) {
         $this->content = is_string($this->data) ? $this->data : Json::encode($this->data);
         if ($this->data !== null && !is_string($this->data) && !$this->headers->has('Content-Type')) {
             $this->headers->set('Content-Type', 'application/json');
         }
         $this->prepared = true;
     }
 }