Explorar o código

move json content middleware

Alexander Belanger %!s(int64=4) %!d(string=hai) anos
pai
achega
ddba969389
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      api/server/router/router.go

+ 3 - 3
api/server/router/router.go

@@ -18,9 +18,6 @@ import (
 func NewAPIRouter(config *config.Config) *chi.Mux {
 	r := chi.NewRouter()
 
-	// set the content type for all API endpoints
-	r.Use(ContentTypeJSON)
-
 	endpointFactory := shared.NewAPIObjectEndpointFactory(config)
 
 	baseRegisterer := NewBaseRegisterer()
@@ -51,6 +48,9 @@ func NewAPIRouter(config *config.Config) *chi.Mux {
 	userRegisterer := NewUserScopedRegisterer(projRegisterer)
 
 	r.Route("/api", func(r chi.Router) {
+		// set the content type for all API endpoints
+		r.Use(ContentTypeJSON)
+
 		baseRoutes := baseRegisterer.GetRoutes(
 			r,
 			config,