30 lines
1.0 KiB
Go
30 lines
1.0 KiB
Go
// Package handlers exposes shared helpers used by the per-domain HTTP
|
|
// handlers under `internal/server/handlers_*.go`. The only helper is
|
|
// NotImplemented, which serves the standard `501 not_implemented`
|
|
// envelope when a route is registered but the handler body is not
|
|
// wired (a defensive fallback for new endpoints in flight).
|
|
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"galaxy/backend/internal/server/httperr"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// NotImplemented returns a gin handler that emits the standard
|
|
// `501 not_implemented` envelope. operationID names the OpenAPI operation the
|
|
// handler will eventually implement; it is interpolated into the human-readable
|
|
// message so that contract tests and operators can identify the endpoint.
|
|
func NotImplemented(operationID string) gin.HandlerFunc {
|
|
message := "endpoint is not implemented yet"
|
|
if operationID != "" {
|
|
message = "endpoint " + operationID + " is not implemented yet"
|
|
}
|
|
|
|
return func(c *gin.Context) {
|
|
httperr.Abort(c, http.StatusNotImplemented, httperr.CodeNotImplemented, message)
|
|
}
|
|
}
|