Request listeners

This commit is contained in:
David Bomba 2023-11-19 15:25:37 +11:00
parent bb2863783d
commit b164218d26
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,43 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Listeners;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Http\Client\Events\RequestSending;
use Illuminate\Queue\SerializesModels;
class LogRequestSending
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
public function handle(RequestSending $event)
{
nlog("Request");
nlog($event->request->headers());
nlog($event->request->url());
nlog(json_encode($event->request->headers()));
nlog($event->request->body());
}
}

View File

@ -137,7 +137,7 @@ use App\Events\Document\DocumentWasRestored;
use App\Events\Invoice\InvoiceWasMarkedSent; use App\Events\Invoice\InvoiceWasMarkedSent;
use App\Events\Vendor\VendorContactLoggedIn; use App\Events\Vendor\VendorContactLoggedIn;
use App\Listeners\Quote\QuoteViewedActivity; use App\Listeners\Quote\QuoteViewedActivity;
use App\Listeners\Request\LogRequestSending; use App\Listeners\LogRequestSending;
use App\Listeners\User\ArchivedUserActivity; use App\Listeners\User\ArchivedUserActivity;
use App\Listeners\User\RestoredUserActivity; use App\Listeners\User\RestoredUserActivity;
use App\Listeners\Quote\QuoteApprovedWebhook; use App\Listeners\Quote\QuoteApprovedWebhook;
@ -289,6 +289,10 @@ class EventServiceProvider extends ServiceProvider
* *
*/ */
protected $listen = [ protected $listen = [
// RequestSending::class => [
// LogRequestSending::class,
// ],
// ResponseReceived::class => [ // ResponseReceived::class => [
// LogResponseReceived::class, // LogResponseReceived::class,
// ], // ],