ucp
Build and Publish / BuildAndDeployArm64 (push) Failing after 6s
Build and Publish / BuildAndDeployAmd64 (push) Has been cancelled

This commit is contained in:
2026-06-24 16:27:22 +02:00
parent e1eb342edf
commit 94b1f9c4ec
7 changed files with 334 additions and 23 deletions
+17 -4
View File
@@ -23,7 +23,7 @@ func OrderHandler(applier OrderReadApplier) http.Handler {
mux.HandleFunc("POST /{id}/fulfillments", s.handleCreateFulfillment)
mux.HandleFunc("POST /{id}/returns", s.handleRequestReturn)
mux.HandleFunc("POST /{id}/refunds", s.handleIssueRefund)
return mux
return withUCPAgent(withJSONContentType(mux))
}
// ---------------------------------------------------------------------------
@@ -46,7 +46,7 @@ func CartHandler(applier CartApplier) http.Handler {
mux.HandleFunc("GET /{id}", s.handleGetCart)
mux.HandleFunc("PUT /{id}", s.handleUpdateCart)
mux.HandleFunc("POST /{id}/cancel", s.handleCancelCart)
return mux
return withUCPAgent(withJSONContentType(mux))
}
// ---------------------------------------------------------------------------
@@ -70,7 +70,7 @@ func CheckoutHandler(applier CheckoutApplier, orderSvc ...OrderApplier) http.Han
mux.HandleFunc("PUT /{id}", s.handleUpdateCheckout)
mux.HandleFunc("POST /{id}/complete", s.handleCompleteCheckout)
mux.HandleFunc("POST /{id}/cancel", s.handleCancelCheckout)
return mux
return withUCPAgent(withJSONContentType(mux))
}
// ---------------------------------------------------------------------------
@@ -113,5 +113,18 @@ func Handler(cartApplier CartApplier, opts Options) http.Handler {
mux.HandleFunc("POST /checkout-sessions/{id}/cancel", checkoutSrv.handleCancelCheckout)
}
return mux
return withUCPAgent(withJSONContentType(mux))
}
// withUCPAgent wraps a handler with UCP-Agent header parsing middleware.
func withUCPAgent(next http.Handler) http.Handler {
return WithUCPAgent(next)
}
// withJSONContentType is a middleware that ensures all responses have Content-Type: application/json.
func withJSONContentType(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
next.ServeHTTP(w, r)
})
}