-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
nsqadmin: format responses #612
Conversation
router.Handle("POST", "/delete_channel", http_api.Decorate(s.deleteChannelHandler, log, http_api.PlainText)) | ||
router.Handle("POST", "/pause_channel", http_api.Decorate(s.pauseChannelHandler, log, http_api.PlainText)) | ||
router.Handle("POST", "/unpause_channel", http_api.Decorate(s.pauseChannelHandler, log, http_api.PlainText)) | ||
router.Handle("POST", "/create_topic_channel", http_api.Decorate(s.createTopicChannelHandler, log, http_api.PlainText)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it makes sense to use a little function-local helper function at this point, maybe something like
func router_reg(method, path string, handler http.Handler) {
router.Handle(method, path, http_api.Decorate(handler, log), http_api.PlainText)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a bad idea but also not necessary
whoooops, thanks 😁 |
router.Handle("GET", "/node/:node", http_api.Decorate(s.nodeHandler, log, http_api.PlainText)) | ||
router.Handle("GET", "/topic/:topic", http_api.Decorate(s.topicHandler, log, http_api.PlainText)) | ||
router.Handle("GET", "/topic/:topic/:channel", http_api.Decorate(s.channelHandler, log, http_api.PlainText)) | ||
router.Handle("GET", "/static/*asset", http_api.Decorate(s.embeddedAssetHandler, log, http_api.PlainText)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meh, I should have dug into this a bit more - only this static route needed the output formatter, all the other template based endpoints write directly to the http.ResponseWriter
.
It's fine though, it won't cause any problems and it's all going away in #323
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they still needed it for early error returns where the handler didn't write a response?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aha!
This fixes a regresion from #610 where some responses from nsqadmin were not handled properly (notably errors and /static/... assets)
RFR @mreiferson