I want to access the other url.URL fields like .RawQuery from v2 echo.Context.
func Index(c echo.Context) error {
log.Println(c.Request().URL().RawQuery)
}
I also would like to have access to other http.Request and http.Response methods not available through context yet.
Thanks!
Echo v2 abstracts underlying HTTP server so you don't have direct access to internal objects like request, response or url. This is done to make Echo compatible with many HTTP servers.
We try to expose most generic methods via engine.* interfaces but if you don't find them you can get get the real objects like below (standard HTTP server):
// `*http.Request`
c.Request().(*standard.Request).Request
// `*http.URL`
c.Request().(*standard.URL).URL
// `http.Header`
c.Request().(*standard.Header).Header
// `http.ResponseWriter`
c.Response().(*standard.Response).ResponseWriter
// `http.Header`
c.Response().(*standard.Header).Header
I will look into exposing new API to fetch query string.
API Request#QueryString() exposed.
mark as ResponseWriter
Most helpful comment
Echo v2 abstracts underlying HTTP server so you don't have direct access to internal objects like request, response or url. This is done to make Echo compatible with many HTTP servers.
We try to expose most generic methods via
engine.*interfaces but if you don't find them you can get get the real objects like below (standard HTTP server):I will look into exposing new API to fetch query string.