chisel icon indicating copy to clipboard operation
chisel copied to clipboard

Respond to /health and /version by request path rather than the whole url string

Open BigSully opened this issue 4 years ago • 1 comments

Request for /health?_t=anything won't return the health info, neither would request for /version if there exists extra query string.

Can we route the /health and /version by request path instead of the whole url string? I can make a pull request if it's okay.

substitute the switch r.URL.String() with switch r.URL.Path:

switch r.URL.Path {
case "/health":
	w.Write([]byte("OK\n"))
	return
case "/version":
	w.Write([]byte(chshare.BuildVersion))
	return
}

BigSully avatar Jan 18 '22 15:01 BigSully

send a PR?

On Wed, 19 Jan 2022 at 2:28 am BigSully @.***> wrote:

Request for /health?_t=anything won't return the health info, neither would request for /version if there exists extra query string.

Can we route the /health and /version by request path instead of the whole url string? I can make a pull request if it's okay.

substitute the switch r.URL.String() https://github.com/jpillora/chisel/blob/v1.7.6/server/server_handler.go#L37 with switch r.URL.Path:

switch r.URL.Path { case "/health": w.Write([]byte("OK\n")) return case "/version": w.Write([]byte(chshare.BuildVersion)) return }

— Reply to this email directly, view it on GitHub https://github.com/jpillora/chisel/issues/327, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE2X4ZX6MESO7U7P37VEZ3UWWBIHANCNFSM5MHPDCRQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jpillora avatar Jan 18 '22 18:01 jpillora