MCPcopy Index your code
hub / github.com/codegangsta/gin / defaultHandler

Method defaultHandler

lib/proxy.go:69–81  ·  view source on GitHub ↗
(res http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

67}
68
69func (p *Proxy) defaultHandler(res http.ResponseWriter, req *http.Request) {
70 errors := p.builder.Errors()
71 if len(errors) > 0 {
72 res.Write([]byte(errors))
73 } else {
74 p.runner.Run()
75 if strings.ToLower(req.Header.Get("Upgrade")) == "websocket" || strings.ToLower(req.Header.Get("Accept")) == "text/event-stream" {
76 proxyWebsocket(res, req, p.to)
77 } else {
78 p.proxy.ServeHTTP(res, req)
79 }
80 }
81}
82
83func proxyWebsocket(w http.ResponseWriter, r *http.Request, host *url.URL) {
84 d, err := net.Dial("tcp", host.Host)

Callers

nothing calls this directly

Calls 3

proxyWebsocketFunction · 0.85
ErrorsMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected