Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kubosuke
Copy link

@kubosuke kubosuke commented May 7, 2023

  • make enable Heartbeat middleware to use in subrouter
  • add test for this middleware

PR for #821

- make enable `Heartbeat` middleware to use in subrouter
- add test for this middleware
Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kubosuke,

would something like this work for you, since we just merged #875?

	r := chi.NewRouter()
	middleware.Heartbeat("/ping")
	
	r.Route("/_api", func(r chi.Router) {
		r.Use(middleware.StripPrefix("/_api"))
		r.Use(middleware.Heartbeat("/ping"))

		r.Handle("/rpc/*", rpcServerHandler)
	})

Heartbeat mw is usually invoked on all server requests, so I'd like to avoid slowing it down with the extra strings.EqualFold().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants