blink\http\Response::prepare PHP Method

prepare() public method

Prepare the response to ready to send to client.
public prepare ( )
    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;
        }
    }