From ba0dbb5354659afdc830d4b7ce28685f47debc1c Mon Sep 17 00:00:00 2001 From: frikky Date: Wed, 20 Oct 2021 13:32:01 +0200 Subject: [PATCH] Bumped Liquidpy and added other webhook protocols (e.g. GET) --- backend/app_sdk/requirements.txt | 2 +- backend/go-app/main.go | 17 +++++++++++++---- docker-compose.yml | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/backend/app_sdk/requirements.txt b/backend/app_sdk/requirements.txt index 79cf5ea2..d561950b 100644 --- a/backend/app_sdk/requirements.txt +++ b/backend/app_sdk/requirements.txt @@ -1,4 +1,4 @@ urllib3==1.26.5 requests==2.25.1 MarkupSafe==2.0.1 -liquidpy==0.7.1 +liquidpy==0.7.2 diff --git a/backend/go-app/main.go b/backend/go-app/main.go index 2b644674..2cd023b4 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -1955,9 +1955,18 @@ func handleWebhookCallback(resp http.ResponseWriter, request *http.Request) { // 1. Get callback data // 2. Load the configuration // 3. Execute the workflow - cors := shuffle.HandleCors(resp, request) - if cors { - return + //cors := shuffle.HandleCors(resp, request) + //if cors { + // return + //} + + if request.Method != "POST" { + request.Method = "POST" + } + + if request.Body == nil { + stringReader := strings.NewReader("") + request.Body = ioutil.NopCloser(stringReader) } path := strings.Split(request.URL.String(), "/") @@ -5732,7 +5741,7 @@ func initHandlers() { // Triggers r.HandleFunc("/api/v1/hooks/new", shuffle.HandleNewHook).Methods("POST", "OPTIONS") - r.HandleFunc("/api/v1/hooks/{key}", handleWebhookCallback).Methods("POST", "OPTIONS") + r.HandleFunc("/api/v1/hooks/{key}", handleWebhookCallback).Methods("POST", "GET", "PATCH", "PUT", "DELETE", "OPTIONS") r.HandleFunc("/api/v1/hooks/{key}/delete", shuffle.HandleDeleteHook).Methods("DELETE", "OPTIONS") // OpenAPI configuration diff --git a/docker-compose.yml b/docker-compose.yml index 4205bb18..eeefca1b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: frontend: - #build: ./frontend + build: ./frontend image: ghcr.io/frikky/shuffle-frontend:nightly container_name: shuffle-frontend hostname: shuffle-frontend @@ -16,7 +16,7 @@ services: depends_on: - backend backend: - #build: ./backend + build: ./backend image: ghcr.io/frikky/shuffle-backend:nightly container_name: shuffle-backend hostname: ${BACKEND_HOSTNAME}