Skip to content

Commit

Permalink
fix(operator): more DTO wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
bo0tzz committed May 6, 2024
1 parent f3fe7c1 commit 992ff1b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/preview-operator/internal/http/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,15 @@ func (previewApi *PreviewApi) getPreview(w http.ResponseWriter, r *http.Request)
return
}

resp := PreviewDTO{
Name: preview.Name,
Spec: preview.Spec,
Status: preview.Status,
}

w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
err = json.NewEncoder(w).Encode(preview)
err = json.NewEncoder(w).Encode(resp)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
Expand Down

0 comments on commit 992ff1b

Please sign in to comment.