mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-15 16:07:51 +03:00
Merge pull request #42 from zviadm/master
fix fasthttpadaptor to work with http.ServeMux in Go 1.5
This commit is contained in:
@@ -5,6 +5,7 @@ package fasthttpadaptor
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
@@ -65,6 +66,9 @@ func NewFastHTTPHandler(h http.Handler) fasthttp.RequestHandler {
|
||||
})
|
||||
r.Header = hdr
|
||||
r.Body = &netHTTPBody{body}
|
||||
// After Go1.5 http.ServeMux uses URL field to get the path for
|
||||
// request routing purposes.
|
||||
r.URL = &url.URL{Path: string(ctx.Path())}
|
||||
|
||||
var w netHTTPResponseWriter
|
||||
h.ServeHTTP(&w, &r)
|
||||
|
||||
Reference in New Issue
Block a user