mirror of
https://github.com/labstack/echo.git
synced 2025-07-13 01:30:31 +02:00
@ -25,8 +25,8 @@ type (
|
|||||||
|
|
||||||
// Request defines the interface for HTTP request.
|
// Request defines the interface for HTTP request.
|
||||||
Request interface {
|
Request interface {
|
||||||
// TLS returns true if HTTP connection is TLS otherwise false.
|
// IsTLS returns true if HTTP connection is TLS otherwise false.
|
||||||
TLS() bool
|
IsTLS() bool
|
||||||
|
|
||||||
// Scheme returns the HTTP protocol scheme, `http` or `https`.
|
// Scheme returns the HTTP protocol scheme, `http` or `https`.
|
||||||
Scheme() string
|
Scheme() string
|
||||||
@ -48,6 +48,9 @@ type (
|
|||||||
// ProtoMajor() int
|
// ProtoMajor() int
|
||||||
// ProtoMinor() int
|
// ProtoMinor() int
|
||||||
|
|
||||||
|
// ContentLength returns the size of request's body.
|
||||||
|
ContentLength() int
|
||||||
|
|
||||||
// UserAgent returns the client's `User-Agent`.
|
// UserAgent returns the client's `User-Agent`.
|
||||||
UserAgent() string
|
UserAgent() string
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// TLS implements `engine.Request#TLS` function.
|
// IsTLS implements `engine.Request#TLS` function.
|
||||||
func (r *Request) TLS() bool {
|
func (r *Request) IsTLS() bool {
|
||||||
return r.IsTLS()
|
return r.IsTLS()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +47,11 @@ func (r *Request) Header() engine.Header {
|
|||||||
return r.header
|
return r.header
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ContentLength implements `engine.Request#ContentLength` function.
|
||||||
|
func (r *Request) ContentLength() int {
|
||||||
|
return r.Request.Header.ContentLength()
|
||||||
|
}
|
||||||
|
|
||||||
// UserAgent implements `engine.Request#UserAgent` function.
|
// UserAgent implements `engine.Request#UserAgent` function.
|
||||||
func (r *Request) UserAgent() string {
|
func (r *Request) UserAgent() string {
|
||||||
return string(r.RequestCtx.UserAgent())
|
return string(r.RequestCtx.UserAgent())
|
||||||
|
@ -19,14 +19,14 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// TLS implements `engine.Request#TLS` function.
|
// IsTLS implements `engine.Request#TLS` function.
|
||||||
func (r *Request) TLS() bool {
|
func (r *Request) IsTLS() bool {
|
||||||
return r.Request.TLS != nil
|
return r.Request.TLS != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scheme implements `engine.Request#Scheme` function.
|
// Scheme implements `engine.Request#Scheme` function.
|
||||||
func (r *Request) Scheme() string {
|
func (r *Request) Scheme() string {
|
||||||
if r.TLS() {
|
if r.IsTLS() {
|
||||||
return "https"
|
return "https"
|
||||||
}
|
}
|
||||||
return "http"
|
return "http"
|
||||||
@ -59,6 +59,11 @@ func (r *Request) Header() engine.Header {
|
|||||||
// return r.request.ProtoMinor()
|
// return r.request.ProtoMinor()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// ContentLength implements `engine.Request#ContentLength` function.
|
||||||
|
func (r *Request) ContentLength() int {
|
||||||
|
return int(r.Request.ContentLength)
|
||||||
|
}
|
||||||
|
|
||||||
// UserAgent implements `engine.Request#UserAgent` function.
|
// UserAgent implements `engine.Request#UserAgent` function.
|
||||||
func (r *Request) UserAgent() string {
|
func (r *Request) UserAgent() string {
|
||||||
return r.Request.UserAgent()
|
return r.Request.UserAgent()
|
||||||
|
@ -25,12 +25,12 @@ func NewRequest(method, url string, body io.Reader) engine.Request {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Request) TLS() bool {
|
func (r *Request) IsTLS() bool {
|
||||||
return r.request.TLS != nil
|
return r.request.TLS != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Request) Scheme() string {
|
func (r *Request) Scheme() string {
|
||||||
if r.TLS() {
|
if r.IsTLS() {
|
||||||
return "https"
|
return "https"
|
||||||
}
|
}
|
||||||
return "http"
|
return "http"
|
||||||
@ -60,6 +60,10 @@ func (r *Request) Header() engine.Header {
|
|||||||
// return r.request.ProtoMinor()
|
// return r.request.ProtoMinor()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
func (r *Request) ContentLength() int {
|
||||||
|
return int(r.request.ContentLength)
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Request) UserAgent() string {
|
func (r *Request) UserAgent() string {
|
||||||
return r.request.UserAgent()
|
return r.request.UserAgent()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user