Explorar el Código

move json content middleware

Alexander Belanger hace 4 años
padre
commit
ddba969389
Se han modificado 1 ficheros con 3 adiciones y 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 {
 func NewAPIRouter(config *config.Config) *chi.Mux {
 	r := chi.NewRouter()
 	r := chi.NewRouter()
 
 
-	// set the content type for all API endpoints
-	r.Use(ContentTypeJSON)
-
 	endpointFactory := shared.NewAPIObjectEndpointFactory(config)
 	endpointFactory := shared.NewAPIObjectEndpointFactory(config)
 
 
 	baseRegisterer := NewBaseRegisterer()
 	baseRegisterer := NewBaseRegisterer()
@@ -51,6 +48,9 @@ func NewAPIRouter(config *config.Config) *chi.Mux {
 	userRegisterer := NewUserScopedRegisterer(projRegisterer)
 	userRegisterer := NewUserScopedRegisterer(projRegisterer)
 
 
 	r.Route("/api", func(r chi.Router) {
 	r.Route("/api", func(r chi.Router) {
+		// set the content type for all API endpoints
+		r.Use(ContentTypeJSON)
+
 		baseRoutes := baseRegisterer.GetRoutes(
 		baseRoutes := baseRegisterer.GetRoutes(
 			r,
 			r,
 			config,
 			config,