MCPcopy Create free account
hub / github.com/mpolden/echoip / CLIHandler

Method CLIHandler

http/http.go:195–202  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

193}
194
195func (s *Server) CLIHandler(w http.ResponseWriter, r *http.Request) *appError {
196 ip, err := ipFromRequest(s.IPHeaders, r, true)
197 if err != nil {
198 return badRequest(err).WithMessage(err.Error()).AsJSON()
199 }
200 fmt.Fprintln(w, ip.String())
201 return nil
202}
203
204func (s *Server) CLICountryHandler(w http.ResponseWriter, r *http.Request) *appError {
205 response, err := s.newResponse(r)

Callers

nothing calls this directly

Calls 5

ipFromRequestFunction · 0.85
badRequestFunction · 0.85
AsJSONMethod · 0.80
WithMessageMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected