From 712760d771b6744ed25ba56806e472e8a3ca4b7a Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Tue, 30 Jan 2018 23:03:22 +0100 Subject: [PATCH] Add reply for GET request --- cmd/hubserver/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/hubserver/main.go b/cmd/hubserver/main.go index adc43b3..5695af0 100644 --- a/cmd/hubserver/main.go +++ b/cmd/hubserver/main.go @@ -201,6 +201,11 @@ func (handler *subscriptionHandler) addSubscriberCallback(topic string, subscrib } func (handler *subscriptionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if r.Method == http.MethodGet { + fmt.Println("WebSub hub") + return + } + if r.Header.Get("Content-Type") != "application/x-www-form-urlencoded" { http.Error(w, "Bad Request", 400) return @@ -222,6 +227,7 @@ func (handler *subscriptionHandler) ServeHTTP(w http.ResponseWriter, r *http.Req return } else if mode == "publish" { handler.handlePublish(w, r) + return } else { http.Error(w, "Unknown hub.mode", 400) return