diff --git a/changelog/unreleased/ocm-generate-invite-event.md b/changelog/unreleased/ocm-generate-invite-event.md index 973e9728e1..811edd7f7b 100644 --- a/changelog/unreleased/ocm-generate-invite-event.md +++ b/changelog/unreleased/ocm-generate-invite-event.md @@ -3,5 +3,6 @@ Enhancement: Publish an event when an OCM invite is generated The ocm generate-invite endpoint now publishes an event whenever an invitation is requested and generated. This event can be subscribed to by other services to react to the generated invitation. +https://github.com/cs3org/reva/pull/4836 https://github.com/cs3org/reva/pull/4832 https://github.com/owncloud/ocis/issues/9583 diff --git a/internal/http/services/sciencemesh/token.go b/internal/http/services/sciencemesh/token.go index ff8d33002f..283c97472e 100644 --- a/internal/http/services/sciencemesh/token.go +++ b/internal/http/services/sciencemesh/token.go @@ -100,10 +100,12 @@ func (h *tokenHandler) Generate(w http.ResponseWriter, r *http.Request) { return } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusCreated) + tknRes := h.prepareGenerateTokenResponse(genTokenRes.GetInviteToken()) if err := json.NewEncoder(w).Encode(tknRes); err != nil { reqres.WriteError(w, r, reqres.APIErrorServerError, "error marshalling token data", err) - return } if h.eventStream != nil { @@ -122,8 +124,6 @@ func (h *tokenHandler) Generate(w http.ResponseWriter, r *http.Request) { } } - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) } // generateRequest is the request body for the Generate endpoint.