You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/msggateway/new/context.go

28 lines
605 B

package new
import "net/http"
type UserConnContext struct {
RespWriter http.ResponseWriter
Req *http.Request
Path string
Method string
RemoteAddr string
}
func newContext(respWriter http.ResponseWriter, req *http.Request) *UserConnContext {
return &UserConnContext{
RespWriter: respWriter,
Req: req,
Path: req.URL.Path,
Method: req.Method,
RemoteAddr: req.RemoteAddr,
}
}
func (c *UserConnContext) Query(key string) string {
return c.Req.URL.Query().Get(key)
}
func (c *UserConnContext) GetHeader(key string) string {
return c.Req.Header.Get(key)
}