diff --git a/pkg/generic/generic.go b/pkg/generic/generic.go index 430b4f6..f7e930b 100644 --- a/pkg/generic/generic.go +++ b/pkg/generic/generic.go @@ -24,9 +24,9 @@ func Handle(cfg config.Config) http.HandlerFunc { log.Error().Err(err).Msg("An error has occurred") } - matrix.PublishText(cfg, vars, reqBody, token) + resp := matrix.PublishText(cfg, vars, reqBody, token) - router.Respond(w, 200, nil) + router.Respond(w, 200, resp) } } diff --git a/pkg/matrix/matrix.go b/pkg/matrix/matrix.go index ec1d1ca..1f3bb11 100644 --- a/pkg/matrix/matrix.go +++ b/pkg/matrix/matrix.go @@ -61,7 +61,7 @@ func GetToken(cfg config.Config, vars map[string]string) string { } // PublishText will publish the data to Matrix using the specified vars. -func PublishText(cfg config.Config, vars map[string]string, data []byte, token string) { +func PublishText(cfg config.Config, vars map[string]string, data []byte, token string) []byte { matrixPublish := struct { MsgType string `json:"msgtype"` Body string `json:"body"` @@ -89,8 +89,7 @@ func PublishText(cfg config.Config, vars map[string]string, data []byte, token s } body, err := ioutil.ReadAll(resp.Body) - fmt.Println(string(body)) - defer resp.Body.Close() + return body }