Add query parameters to url

This commit is contained in:
Peter Stuifzand 2018-01-29 22:41:57 +01:00
parent 1600b6740c
commit 841d57538f

View File

@ -66,9 +66,11 @@ func (handler *subscriptionHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
client := http.Client{} client := http.Client{}
validationURL := callbackURL validationURL := callbackURL
validationURL.Query().Add("hub.mode", "subscribe") q := validationURL.Query()
validationURL.Query().Add("hub.topic", topicURL.String()) q.Add("hub.mode", "subscribe")
validationURL.Query().Add("hub.challenge", RandStringBytes(12)) q.Add("hub.topic", topicURL.String())
q.Add("hub.challenge", RandStringBytes(12))
validationURL.RawQuery = q.Encode()
log.Println(validationURL) log.Println(validationURL)
@ -93,5 +95,5 @@ func (handler *subscriptionHandler) ServeHTTP(w http.ResponseWriter, r *http.Req
func main() { func main() {
http.Handle("/", &subscriptionHandler{}) http.Handle("/", &subscriptionHandler{})
log.Fatal(http.ListenAndServe(":80", nil)) tlog.Fatal(http.ListenAndServe(":80", nil))
} }