-
Notifications
You must be signed in to change notification settings - Fork 0
/
httpcontext.go
77 lines (61 loc) · 1.51 KB
/
httpcontext.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package hygienic
import (
"mime/multipart"
"net/http"
"time"
)
type HTTPContext struct {
req *http.Request
}
func (ctx *HTTPContext) Deadline() (deadline time.Time, ok bool) {
panic("implement me")
}
func (ctx *HTTPContext) Done() <-chan struct{} {
panic("implement me")
}
func (ctx *HTTPContext) Err() error {
panic("implement me")
}
func (ctx *HTTPContext) Value(key interface{}) interface{} {
panic("implement me")
}
func (ctx *HTTPContext) FormFile(key string) (*multipart.FileHeader, error) {
panic("implement me")
}
func (ctx *HTTPContext) Set(key string, value interface{}) {
panic("implement me")
}
func (ctx *HTTPContext) GetHeader(key string) string {
panic("implement me")
}
func (ctx *HTTPContext) Param(key string) string {
panic("implement me")
}
func (ctx *HTTPContext) Query(key string) string {
panic("implement me")
}
func (ctx *HTTPContext) ValidateJSON(rules map[string][]string, data interface{}) error {
if err := govalidator.New(govalidator.Options{
Request: ctx.gin.Request,
Data: data,
Rules: rules,
}).ValidateJSON(); len(err) > 0 {
return entities.NewGlobErr(entities.SolarErrBadInput, "Invalid request body").WithDetail(err)
} else {
return nil
}
}
func (ctx *HTTPContext) GetSession() (interface{}, error) {
panic("implement me")
}
func (ctx *HTTPContext) GetSessionOrThrow() interface{} {
panic("implement me")
}
func (ctx *HTTPContext) Request() *http.Request {
return ctx.req
}
func newHTTPContext(req *http.Request) Context {
return &HTTPContext{
req: req,
}
}