-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxp_http.go
40 lines (32 loc) · 828 Bytes
/
xp_http.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package xparam
import "net/http"
//------------------------------------------------------------
// Xparam HTTP request related values
//------------------------------------------------------------
// Gets http.Request.
func (xp XP) Get_HttpRequest() (req *http.Request) {
if val, ok := xp["_httpReq"]; ok && val != nil {
if req, ok = val.(*http.Request); ok {
return
}
}
return
}
// Gets http.ResponseWriter.
func (xp XP) Get_HttpResponseWriter() (rw http.ResponseWriter) {
if val, ok := xp["_httpResWriter"]; ok && val != nil {
if rw, ok = val.(http.ResponseWriter); ok {
return
}
}
return
}
// Gets session values.
func (xp XP) Get_SessionValues() (vals map[string]string) {
if val, ok := xp["_session"]; ok && val != nil {
if vals, ok = val.(map[string]string); ok {
return
}
}
return
}