mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
chore: implement better 404 for unimplemented scim endpoints (#15232)
Prior to this, html was returned.
This commit is contained in:
@ -455,7 +455,7 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
|
||||
if len(options.SCIMAPIKey) != 0 {
|
||||
api.AGPL.RootHandler.Route("/scim/v2", func(r chi.Router) {
|
||||
r.Use(
|
||||
api.scimEnabledMW,
|
||||
api.RequireFeatureMW(codersdk.FeatureSCIM),
|
||||
)
|
||||
r.Post("/Users", api.scimPostUser)
|
||||
r.Route("/Users", func(r chi.Router) {
|
||||
@ -464,6 +464,13 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
|
||||
r.Get("/{id}", api.scimGetUser)
|
||||
r.Patch("/{id}", api.scimPatchUser)
|
||||
})
|
||||
r.NotFound(func(w http.ResponseWriter, r *http.Request) {
|
||||
u := r.URL.String()
|
||||
httpapi.Write(r.Context(), w, http.StatusNotFound, codersdk.Response{
|
||||
Message: fmt.Sprintf("SCIM endpoint %s not found", u),
|
||||
Detail: "This endpoint is not implemented. If it is correct and required, please contact support.",
|
||||
})
|
||||
})
|
||||
})
|
||||
} else {
|
||||
// Show a helpful 404 error. Because this is not under the /api/v2 routes,
|
||||
|
Reference in New Issue
Block a user