EchoMiddleWare
in package
Table of Contents
Constants
- ENCODED_ECHO_PARAM = '%5F%5Fecho%5F%5F=&'
- encoded "__echo__&".
Properties
Methods
- __construct() : mixed
- __invoke() : mixed
- getEchoFromRequest() : string
- Try to find the content stored in log for a previous request.
- hasEchoInBody() : bool
- check if $body contains a '__echo__=&' param.
- logRequestToEcho() : mixed
- Log the URL and its body in the 'echoproxy' log file We add a md5 hash of the string to help retrieving it later NOTE : currently we log only the url & body, thus it doesn't really need to be logged because the same url & body are needed to retrieve the content but the function will be useful when it will log additional content.
- buildResponseCallable() : callable
Constants
ENCODED_ECHO_PARAM
encoded "__echo__&".
public
mixed
ENCODED_ECHO_PARAM
= '%5F%5Fecho%5F%5F=&'
Properties
$appContext
private
AppContextInterface
$appContext
Methods
__construct()
public
__construct(AppContextInterface $appContext) : mixed
Parameters
- $appContext : AppContextInterface
__invoke()
public
__invoke(callable $handler) : mixed
Parameters
- $handler : callable
getEchoFromRequest()
Try to find the content stored in log for a previous request.
public
getEchoFromRequest(string $url, string $body) : string
Parameters
- $url : string
-
request URL
- $body : string
-
request body
Return values
stringhasEchoInBody()
check if $body contains a '__echo__=&' param.
public
hasEchoInBody(string $body) : bool
Parameters
- $body : string
Return values
boollogRequestToEcho()
Log the URL and its body in the 'echoproxy' log file We add a md5 hash of the string to help retrieving it later NOTE : currently we log only the url & body, thus it doesn't really need to be logged because the same url & body are needed to retrieve the content but the function will be useful when it will log additional content.
public
logRequestToEcho(string $url, string $body) : mixed
Parameters
- $url : string
- $body : string
buildResponseCallable()
protected
buildResponseCallable(mixed $content) : callable
Parameters
- $content : mixed