This commit is contained in:
Philipp Heckel 2022-07-18 14:37:51 -04:00
parent 09cb1482b4
commit 466c9874a8
6 changed files with 114 additions and 76 deletions

View file

@ -447,6 +447,11 @@ func (s *Server) handleMatrixDiscovery(w http.ResponseWriter) error {
return writeMatrixDiscoveryResponse(w)
}
type inputMessage struct {
message
cache bool
}
func (s *Server) handlePublishWithoutResponse(r *http.Request, v *visitor) (*message, error) {
t, err := s.topicFromPath(r.URL.Path)
if err != nil {
@ -1367,7 +1372,7 @@ func (s *Server) transformBodyJSON(next handleFunc) handleFunc {
return err
}
defer r.Body.Close()
var m publishMessage
var m PublishMessage
if err := json.NewDecoder(body).Decode(&m); err != nil {
return errHTTPBadRequestJSONInvalid
}

View file

@ -64,8 +64,8 @@ func newAction() *action {
}
}
// publishMessage is used as input when publishing as JSON
type publishMessage struct {
// PublishMessage is used as input when publishing as JSON
type PublishMessage struct {
Topic string `json:"topic"`
Title string `json:"title"`
Message string `json:"message"`