Last active
March 1, 2023 06:37
-
-
Save ilvalerione/bfed884d237a4c8cb6899443916bc096 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
InspectorMonitoringMiddleware extends \Inspector\Laravel\Middleware\WebRequestMonitoring | |
{ | |
public function terminate($request, $response) | |
{ | |
parent::terminate($request, $response); | |
// Get what you want from the $request | |
inspector()->transaction()->http->request->headers = $request->headers->all(); | |
} | |
} |
@opn-sumit It should checked the existance if an active transaction before the statement.
if (inspector()->hasTransaction()) {
inspector()->transaction()->http->request->headers = $request->headers->all();
}
Because it could be a request for an endpoint not monitored. In that case the transaction is not be started.
thanks @ilvalerione , it worked.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
inspector()->transaction()
returns null randomly and then throws error, when trying to set headers