Skip to content

Commit

Permalink
Merge pull request #4836 from butonic/write-body-after-header
Browse files Browse the repository at this point in the history
OCM: write body after header
  • Loading branch information
butonic authored Sep 5, 2024
2 parents 2df3775 + 5460505 commit cf5e5eb
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.StatusOK) // FIXME this should be a 201 created status. Tracked in https://github.com/cs3org/reva/issues/4838

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 cf5e5eb

Please sign in to comment.