Skip to content
Snippets Groups Projects
Verified Commit 7e291a49 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

fix: request url for listener

parent 602412d7
No related branches found
No related tags found
No related merge requests found
Pipeline #3037 passed
...@@ -77,7 +77,8 @@ func (bot *MatrixBot) Serve(endpoint string) { ...@@ -77,7 +77,8 @@ func (bot *MatrixBot) Serve(endpoint string) {
http.HandleFunc("/healthz", func(writer http.ResponseWriter, request *http.Request) { http.HandleFunc("/healthz", func(writer http.ResponseWriter, request *http.Request) {
_, _ = io.WriteString(writer, "OK\n") _, _ = io.WriteString(writer, "OK\n")
}) })
http.HandleFunc(bot.pushUrl.RequestURI(), func(writer http.ResponseWriter, request *http.Request) { log.Printf("listening for push notifications on %s\n", bot.pushUrl.Path)
http.HandleFunc(bot.pushUrl.Path, func(writer http.ResponseWriter, request *http.Request) {
log.Println("Received push notification") log.Println("Received push notification")
notification, err := api.ParseNotification(request.Body) notification, err := api.ParseNotification(request.Body)
if err != nil { if err != nil {
...@@ -105,5 +106,6 @@ func (bot *MatrixBot) Serve(endpoint string) { ...@@ -105,5 +106,6 @@ func (bot *MatrixBot) Serve(endpoint string) {
} }
writer.WriteHeader(204) writer.WriteHeader(204)
}) })
fmt.Printf("listening for requests on %s\n", endpoint)
log.Fatal(http.ListenAndServe(endpoint, nil)) log.Fatal(http.ListenAndServe(endpoint, nil))
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment