Skip to content

Commit

Permalink
Making sure webhook is signed, and payload is sent
Browse files Browse the repository at this point in the history
  • Loading branch information
JustSteveKing committed May 31, 2023
1 parent 0c2e671 commit c9156f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Builder/PendingWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ public function send(Method $method = Method::POST): Response
/** @phpstan-ignore-next-line */
$this->request->withHeaders(
headers: [
strval(config('webhooks.signing.header')) => $this->signature ?: $this->signed()->signature,
strval(config('webhooks.signing.header')) => $this->signer->sign(
payload: $this->payload,
),
],
);
}
Expand All @@ -151,6 +153,9 @@ public function send(Method $method = Method::POST): Response
return $this->request->send(
method: $method->value,
url: $this->url,
options: [
'json' => $this->payload,
]
)->throw();
}
}
1 change: 1 addition & 0 deletions src/Providers/PackageServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function register(): void
signer: $this->app->make(
abstract: SigningContract::class,
),
signature: strval(config('webhooks.signing.key')),
),
);
}
Expand Down

0 comments on commit c9156f9

Please sign in to comment.