mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-11 05:39:02 +08:00
28 lines
605 B
Go
28 lines
605 B
Go
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)
|
|
}
|