Implement review suggestions

This commit is contained in:
Daniel 2021-01-19 16:26:44 +01:00
parent 40c2849bab
commit ab05924bcf
4 changed files with 17 additions and 15 deletions

View file

@ -11,6 +11,16 @@ import (
)
func registerDebugEndpoints() error {
if err := RegisterEndpoint(Endpoint{
Path: "ping",
Read: PermitAnyone,
ActionFunc: ping,
Name: "Ping",
Description: "Pong.",
}); err != nil {
return err
}
if err := RegisterEndpoint(Endpoint{
Path: "debug/stack",
Read: PermitAnyone,
@ -50,6 +60,11 @@ func registerDebugEndpoints() error {
return nil
}
// ping responds with pong.
func ping(ar *Request) (msg string, err error) {
return "Pong.", nil
}
// getStack returns the current goroutine stack.
func getStack(_ *Request) (data []byte, err error) {
buf := &bytes.Buffer{}