( w ResponseWriter, tr *tracing.TracedHTTPRequest, isWebsocket bool, )
| 70 | type mockOriginProxy struct{} |
| 71 | |
| 72 | func (moc *mockOriginProxy) ProxyHTTP( |
| 73 | w ResponseWriter, |
| 74 | tr *tracing.TracedHTTPRequest, |
| 75 | isWebsocket bool, |
| 76 | ) error { |
| 77 | req := tr.Request |
| 78 | if isWebsocket { |
| 79 | switch req.URL.Path { |
| 80 | case "/ws/echo": |
| 81 | return wsEchoEndpoint(w, req) |
| 82 | case "/ws/flaky": |
| 83 | return wsFlakyEndpoint(w, req) |
| 84 | default: |
| 85 | originRespEndpoint(w, http.StatusNotFound, []byte("ws endpoint not found")) |
| 86 | return fmt.Errorf("unknown websocket endpoint %s", req.URL.Path) |
| 87 | } |
| 88 | } |
| 89 | switch req.URL.Path { |
| 90 | case "/ok": |
| 91 | originRespEndpoint(w, http.StatusOK, []byte(http.StatusText(http.StatusOK))) |
| 92 | case "/large_file": |
| 93 | originRespEndpoint(w, http.StatusOK, testLargeResp) |
| 94 | case "/400": |
| 95 | originRespEndpoint(w, http.StatusBadRequest, []byte(http.StatusText(http.StatusBadRequest))) |
| 96 | case "/500": |
| 97 | originRespEndpoint(w, http.StatusInternalServerError, []byte(http.StatusText(http.StatusInternalServerError))) |
| 98 | case "/error": |
| 99 | return fmt.Errorf("Failed to proxy to origin") |
| 100 | default: |
| 101 | originRespEndpoint(w, http.StatusNotFound, []byte("page not found")) |
| 102 | } |
| 103 | return nil |
| 104 | } |
| 105 | |
| 106 | func (moc *mockOriginProxy) ProxyTCP( |
| 107 | ctx context.Context, |
nothing calls this directly
no test coverage detected