diff --git a/fasthttpadaptor/adaptor.go b/fasthttpadaptor/adaptor.go index 47a4c292ce..dcd43e4431 100644 --- a/fasthttpadaptor/adaptor.go +++ b/fasthttpadaptor/adaptor.go @@ -109,3 +109,5 @@ func (w *netHTTPResponseWriter) WriteHeader(statusCode int) { func (w *netHTTPResponseWriter) Write(p []byte) (int, error) { return w.w.Write(p) } + +func (w *netHTTPResponseWriter) Flush() {} diff --git a/fasthttpadaptor/request.go b/fasthttpadaptor/request.go index cc2684bca2..d763a98542 100644 --- a/fasthttpadaptor/request.go +++ b/fasthttpadaptor/request.go @@ -25,8 +25,12 @@ func ConvertRequest(ctx *fasthttp.RequestCtx, r *http.Request, forServer bool) e } r.Method = b2s(ctx.Method()) - r.Proto = "HTTP/1.1" - r.ProtoMajor = 1 + r.Proto = b2s(ctx.Request.Header.Protocol()) + if r.Proto == "HTTP/2" { + r.ProtoMajor = 2 + } else { + r.ProtoMajor = 1 + } r.ProtoMinor = 1 r.ContentLength = int64(len(body)) r.RemoteAddr = ctx.RemoteAddr().String()