protected function _redirect(ServerRequest $request, Response $response) {
		$message = $request->getSession()->consume($this->_config['flashKey']);
		$url = $response->getHeader('Location')[0];
		$status = $response->getStatusCode();

		$json = JsonEncoder::encode([
			// Error and content are here to make the output the same as previously
			// with the component, so existing unit tests don't break.
			'error' => null,
			'content' => null,
			'_message' => $message,
			'_redirect' => compact('url', 'status'),
		], $this->_config['jsonOptions']);

		$response = $response->withStatus(200)
			->withoutHeader('Location')
			->withHeader('Content-Type', 'application/json; charset=' . $response->getCharset())
			->withStringBody($json);

		return $response;
	}
protected function _redirect(ServerRequest $request, Response $response) {
		$message = $request->getSession()->consume($this->_config['flashKey']);
		$url = $response->getHeader('Location')[0];
		$status = $response->getStatusCode();

		$json = JsonEncoder::encode([
			// Error and content are here to make the output the same as previously
			// with the component, so existing unit tests don't break.
			'error' => null,
			'content' => null,
			'_message' => $message,
			'_redirect' => compact('url', 'status'),
		], $this->_config['jsonOptions']);

		$response = $response->withStatus(200)
			->withoutHeader('Location')
			->withHeader('Content-Type', 'application/json; charset=' . $response->getCharset())
			->withStringBody($json);

		return $response;
	}
protected function _redirect ( ServerRequest $ request , Response $ response ) { $ message = $ request -> getSession ( ) -> consume ( $ this -> _config [ 'flashKey' ] ) ; $ url = $ response -> getHeader ( 'Location' ) [ 0 ] ; $ status = $ response -> getStatusCode ( ) ; $ json = JsonEncoder :: encode ( [ // Error and content are here to make the output the same as previously // with the component, so existing unit tests don't break. 'error' => null , 'content' => null , '_message' => $ message , '_redirect' => compact ( 'url' , 'status' ) , ] , $ this -> _config [ 'jsonOptions' ] ) ; $ response = $ response -> withStatus ( 200 ) -> withoutHeader ( 'Location' ) -> withHeader ( 'Content-Type' , 'application/json; charset=' . $ response -> getCharset ( ) ) -> withStringBody ( $ json ) ; return $ response ; }
Generate a JSON response encoding the redirect

@param \Cake\Http\ServerRequest $request The request.
@param \Cake\Http\Response $response The response.
@return \Cake\Http\Response A response.
@throws \RuntimeException
Generate a JSON response encoding the redirect