Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): add api initialization notice #4869

Merged
merged 13 commits into from
Oct 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(api): revert changes regarding Handler
  • Loading branch information
gacevicljubisa committed Oct 23, 2024
commit 46bc6a097a772e6048b55739af29035688f77419
26 changes: 17 additions & 9 deletions pkg/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ func (s *Service) Mount() {
s.mountBusinessDebug()
s.mountAPI()

s.Handler = web.ChainHandlers(
httpaccess.NewHTTPAccessLogHandler(s.logger, s.tracer, "api access"),
handlers.CompressHandler,
s.corsHandler,
web.NoCacheHeadersHandler,
web.FinalHandler(router),
)
}

// EnableFullAPI will enable all available endpoints, because some endpoints are not available during syncing.
func (s *Service) EnableFullAPI() {
if s == nil {
return
}

s.fullAPIEnabled = true

compressHandler := func(h http.Handler) http.Handler {
downloadEndpoints := []string{
"/bzz",
Expand Down Expand Up @@ -86,15 +103,6 @@ func (s *Service) Mount() {
)
}

// EnableFullAPI will enable all available endpoints, because some endpoints are not available during syncing.
func (s *Service) EnableFullAPI() {
if s == nil {
return
}

s.fullAPIEnabled = true
}

func (s *Service) mountTechnicalDebug() {
s.router.Handle("/node", jsonhttp.MethodHandler{
"GET": http.HandlerFunc(s.nodeGetHandler),
Expand Down
Loading