gateway: handle skipped webhook

This commit is contained in:
Simone Gotti 2019-04-03 17:05:50 +02:00
parent 84879bf591
commit 58a77ad221
1 changed files with 13 additions and 0 deletions

View File

@ -174,6 +174,13 @@ func (h *webhooksHandler) handleWebhook(r *http.Request) (int, string, error) {
if err != nil { if err != nil {
return http.StatusBadRequest, "", errors.Wrapf(err, "failed to parse webhook") return http.StatusBadRequest, "", errors.Wrapf(err, "failed to parse webhook")
} }
// skip nil webhook data
// TODO(sgotti) report the reason of the skip
if webhookData == nil {
h.log.Infof("skipping webhook")
return 0, "", nil
}
webhookData.ProjectID = projectID webhookData.ProjectID = projectID
// get project variables // get project variables
@ -223,6 +230,12 @@ func (h *webhooksHandler) handleWebhook(r *http.Request) (int, string, error) {
if err != nil { if err != nil {
return http.StatusBadRequest, "", errors.Wrapf(err, "failed to parse webhook") return http.StatusBadRequest, "", errors.Wrapf(err, "failed to parse webhook")
} }
// skip nil webhook data
// TODO(sgotti) report the reason of the skip
if webhookData == nil {
h.log.Infof("skipping webhook")
return 0, "", nil
}
user, _, err := h.configstoreClient.GetUser(ctx, userID) user, _, err := h.configstoreClient.GetUser(ctx, userID)
if err != nil { if err != nil {