Skip to content

Commit

Permalink
write body after header
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Sep 5, 2024
1 parent 9878984 commit 015ec00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog/unreleased/ocm-generate-invite-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions internal/http/services/sciencemesh/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand Down

0 comments on commit 015ec00

Please sign in to comment.