MCPcopy
hub / github.com/gorilla/mux / stringHandler

Function stringHandler

mux_test.go:2945–2952  ·  view source on GitHub ↗

stringHandler returns a handler func that writes a message 's' to the http.ResponseWriter.

(s string)

Source from the content-addressed store, hash-verified

2943// stringHandler returns a handler func that writes a message 's' to the
2944// http.ResponseWriter.
2945func stringHandler(s string) http.HandlerFunc {
2946 return func(w http.ResponseWriter, r *http.Request) {
2947 _, err := w.Write([]byte(s))
2948 if err != nil {
2949 log.Printf("Failed writing HTTP response: %v", err)
2950 }
2951 }
2952}
2953
2954// newRequest is a helper function to create a new request with a method and url.
2955// The request returned is a 'server' request as opposed to a 'client' one through

Callers 2

TestCORSMethodMiddlewareFunction · 0.85

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected