Add reply for GET request
This commit is contained in:
parent
09ec4a556e
commit
712760d771
|
@ -201,6 +201,11 @@ func (handler *subscriptionHandler) addSubscriberCallback(topic string, subscrib
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *subscriptionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
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" {
|
if r.Header.Get("Content-Type") != "application/x-www-form-urlencoded" {
|
||||||
http.Error(w, "Bad Request", 400)
|
http.Error(w, "Bad Request", 400)
|
||||||
return
|
return
|
||||||
|
@ -222,6 +227,7 @@ func (handler *subscriptionHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
|
||||||
return
|
return
|
||||||
} else if mode == "publish" {
|
} else if mode == "publish" {
|
||||||
handler.handlePublish(w, r)
|
handler.handlePublish(w, r)
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
http.Error(w, "Unknown hub.mode", 400)
|
http.Error(w, "Unknown hub.mode", 400)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user