TUN-3489: Add unit tests to cover proxy logic in connection package of cloudflared

This commit is contained in:
cthuang
2020-10-27 22:27:15 +00:00
parent 5974fb4cfd
commit d5769519b2
9 changed files with 754 additions and 92 deletions

View File

@@ -60,7 +60,7 @@ func (c *client) Proxy(w connection.ResponseWriter, req *http.Request, isWebsock
}
if err != nil {
c.logRequestError(err, cfRay, ruleNum)
w.WriteErrorResponse(err)
w.WriteErrorResponse()
return err
}
c.logOriginResponse(resp, cfRay, lbProbe, ruleNum)

View File

@@ -47,7 +47,7 @@ func (w *mockHTTPRespWriter) WriteRespHeaders(resp *http.Response) error {
return nil
}
func (w *mockHTTPRespWriter) WriteErrorResponse(err error) {
func (w *mockHTTPRespWriter) WriteErrorResponse() {
w.WriteHeader(http.StatusBadGateway)
}