File tree 2 files changed +30
-1
lines changed
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ abstract class WebhookCallEvent
10
10
public function __construct (
11
11
public string $ httpVerb ,
12
12
public string $ webhookUrl ,
13
- public array $ payload ,
13
+ public array | string $ payload ,
14
14
public array $ headers ,
15
15
public array $ meta ,
16
16
public array $ tags ,
Original file line number Diff line number Diff line change @@ -321,3 +321,32 @@ function baseGetRequest(array $overrides = []): array
321
321
->testClient
322
322
->assertRequestsMade ([$ baseRequest ]);
323
323
});
324
+
325
+
326
+ it ('send raw body data in event if rawBody is set ' , function () {
327
+ $ this ->testClient ->throwConnectionException ();
328
+
329
+ $ testBody = "<xml>anotherOption</xml> " ;
330
+ WebhookCall::create ()
331
+ ->url ('https://example.com/webhooks ' )
332
+ ->useSecret ('abc ' )
333
+ ->sendRawBody ($ testBody )
334
+ ->doNotSign ()
335
+ ->dispatch ();
336
+
337
+ $ baseRequest = baseRequest ();
338
+
339
+ $ baseRequest ['options ' ]['body ' ] = $ testBody ;
340
+ unset($ baseRequest ['options ' ]['headers ' ]['Signature ' ]);
341
+
342
+ artisan ('queue:work --once ' );
343
+
344
+ Event::assertDispatched (WebhookCallFailedEvent::class, function (WebhookCallFailedEvent $ event ) use ($ testBody ) {
345
+ expect ($ event ->errorType )->not ->toBeNull ()
346
+ ->and ($ event ->errorMessage )->not ->toBeNull ()
347
+ ->and ($ event ->payload )->toBe ($ testBody );
348
+
349
+ return true ;
350
+ });
351
+ });
352
+
You can’t perform that action at this time.
0 commit comments