Created
August 18, 2022 07:16
-
-
Save ilvalerione/9a4fd4ee966868ca2c106f961088449e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use \Inspector\Laravel\Middleware\WebRequestMonitoring; | |
class InspectorFilterMonitoringMiddleware extends WebRequestMonitoring | |
{ | |
/** | |
* Terminates a request/response cycle. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \Illuminate\Http\Response $response | |
*/ | |
public function terminate($request, $response) | |
{ | |
if (Inspector::isRecording() && Inspector::hasTransaction()) { | |
Inspector::currentTransaction() | |
->addContext('Request Body', Filters::hideParameters( | |
$request->request->all(), | |
config('inspector.hidden_parameters') | |
)) | |
->addContext('Response', [ | |
'status_code' => $response->getStatusCode(), | |
'version' => $response->getProtocolVersion(), | |
'charset' => $response->getCharset(), | |
'headers' => array_filter($response->headers->all(), function ($value, $key) { | |
return $key !== 'Authorization'; | |
}), | |
]) | |
->setResult($response->getStatusCode()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment