passthroughError emits the upstream's error response unchanged.
(c echo.Context, statusCode int, contentType string, body io.Reader)
| 40 | |
| 41 | // passthroughError emits the upstream's error response unchanged. |
| 42 | func passthroughError(c echo.Context, statusCode int, contentType string, body io.Reader) error { |
| 43 | const maxErrBody = 1 << 20 |
| 44 | buf, _ := io.ReadAll(io.LimitReader(body, maxErrBody)) |
| 45 | if contentType != "" { |
| 46 | c.Response().Header().Set("Content-Type", contentType) |
| 47 | } |
| 48 | c.Response().WriteHeader(statusCode) |
| 49 | _, _ = c.Response().Writer.Write(buf) |
| 50 | return nil |
| 51 | } |
| 52 | |
| 53 | func forwardBuffered(c echo.Context, statusCode int, contentType string, body io.Reader) error { |
| 54 | if contentType != "" { |
no test coverage detected