Webiny\Component\Http\Response::setStatusCode PHP Method

setStatusCode() public method

Set HTTP response status code. The status code must be a valid HTTP status code, or an exception will be thrown.
public setStatusCode ( integer $statusCode, string $message = '' )
$statusCode integer Http status code.
$message string Http status message. If not set we will use the default message by RFC2616.
    public function setStatusCode($statusCode, $message = '')
    {
        if (empty($message)) {
            if (!isset(self::$httpStatuses[$statusCode])) {
                throw new ResponseException('Invalid status code provided: "' . $statusCode . '".');
            } else {
                $this->statusMessage = self::$httpStatuses[$statusCode];
            }
        } else {
            $this->statusMessage = $message;
        }
        $this->statusCode = $statusCode;
        return $this;
    }