-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customize response #84
Comments
You could listen for the |
Hi @freekmurze I was just looking into this exact thing as a company I'm working with received the 500 Internal Server Error and pointed their fingers at me, when the issue was in their side not sending the signature. I think a 401 Unauthorized is a better response code as it's their input which fails to pass validation. Would you be willing to consider this change? |
Send a PR with tests, and I'll consider merging it in. |
@kasperwandahl @whoami213 use Spatie\WebhookClient\Exceptions\WebhookFailed;
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->renderable(function (WebhookFailed $e, $request) {
if ($request->is('api/*') && $e->getMessage() == 'The signature is invalid.') {
return response()->json(['message' => $e->getMessage()], 401);
}
});
} |
Hi, it is possible to customize the error response to invalid signature? Instead of 500 I will customize it to 401, like for Xero accounting app.
The text was updated successfully, but these errors were encountered: