2016-01-29 09:46:11 +02:00
|
|
|
package standard
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/labstack/echo/engine"
|
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
Request struct {
|
|
|
|
request *http.Request
|
|
|
|
url engine.URL
|
|
|
|
header engine.Header
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
func NewRequest(r *http.Request) *Request {
|
|
|
|
return &Request{
|
|
|
|
request: r,
|
2016-02-05 00:40:08 +02:00
|
|
|
url: &URL{url: r.URL},
|
2016-01-29 09:46:11 +02:00
|
|
|
header: &Header{r.Header},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-09 02:48:03 +02:00
|
|
|
func (r *Request) Object() interface{} {
|
2016-01-29 09:46:11 +02:00
|
|
|
return r.request
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Request) URL() engine.URL {
|
|
|
|
return r.url
|
|
|
|
}
|
|
|
|
|
2016-02-09 02:48:03 +02:00
|
|
|
func (r *Request) Header() engine.Header {
|
|
|
|
return r.header
|
|
|
|
}
|
|
|
|
|
2016-01-29 09:46:11 +02:00
|
|
|
func (r *Request) RemoteAddress() string {
|
|
|
|
return r.request.RemoteAddr
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Request) Method() string {
|
|
|
|
return r.request.Method
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Request) URI() string {
|
|
|
|
return r.request.RequestURI
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Request) Body() io.ReadCloser {
|
|
|
|
return r.request.Body
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Request) FormValue(name string) string {
|
|
|
|
return r.request.FormValue(name)
|
|
|
|
}
|
2016-02-05 00:40:08 +02:00
|
|
|
|
|
|
|
func (r *Request) reset(req *http.Request, h engine.Header, u engine.URL) {
|
|
|
|
r.request = req
|
|
|
|
r.header = h
|
|
|
|
r.url = u
|
|
|
|
}
|