Save last payload in memory for request lifetime

This commit is contained in:
Eldad Fux 2020-09-08 23:08:02 +03:00
parent 14fac182ea
commit 9bd3e4dcbd

View file

@ -97,6 +97,11 @@ class Response extends SwooleResponse
const MODEL_DOMAIN = 'domain'; const MODEL_DOMAIN = 'domain';
const MODEL_DOMAIN_LIST = 'domainList'; const MODEL_DOMAIN_LIST = 'domainList';
/**
* @var array
*/
protected $payload = [];
/** /**
* Response constructor. * Response constructor.
*/ */
@ -240,6 +245,8 @@ class Response extends SwooleResponse
$output[$key] = $data[$key]; $output[$key] = $data[$key];
} }
$this->payload = $output;
return $output; return $output;
} }
@ -264,4 +271,12 @@ class Response extends SwooleResponse
->send(yaml_emit($data, YAML_UTF8_ENCODING)) ->send(yaml_emit($data, YAML_UTF8_ENCODING))
; ;
} }
/**
* @return array
*/
public function getPayload():array
{
return $this->payload;
}
} }