fix(router/webhooks): correct webhook error mapping and make source verification optional for all connectors (#1333)

This commit is contained in:
ItsMeShashank
2023-06-02 15:30:37 +05:30
committed by GitHub
parent b681f78d96
commit 71315097dd
23 changed files with 191 additions and 114 deletions

View File

@ -629,7 +629,9 @@ pub async fn webhooks_core<W: api::OutgoingWebhookType>(
connector_name,
api::GetToken::Connector,
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.change_context(errors::ApiErrorResponse::InvalidRequestData {
message: "invalid connnector name received".to_string(),
})
.attach_printable("Failed construction of ConnectorData")?;
let connector = connector.connector;
@ -654,7 +656,7 @@ pub async fn webhooks_core<W: api::OutgoingWebhookType>(
let event_type = connector
.get_webhook_event_type(&request_details)
.change_context(errors::ApiErrorResponse::InternalServerError)
.switch()
.attach_printable("Could not find event type in incoming webhook body")?;
let process_webhook_further = utils::lookup_webhook_event(