This repository was archived by the owner on May 24, 2020. It is now read-only.
File tree 2 files changed +14
-12
lines changed
2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -141,21 +141,10 @@ func (self *ResourceHandler) SetRoutes(routes ...Route) error {
141
141
routes : routes ,
142
142
}
143
143
144
- self .env = & env {}
145
-
146
144
// add the status route as the last route.
147
145
if self .EnableStatusService == true {
148
146
self .statusService = newStatusService ()
149
- self .internalRouter .routes = append (
150
- self .internalRouter .routes ,
151
- Route {
152
- HttpMethod : "GET" ,
153
- PathExp : "/.status" ,
154
- Func : func (writer * ResponseWriter , request * Request ) {
155
- self .statusService .getStatus (writer , request )
156
- },
157
- },
158
- )
147
+ self .internalRouter .routes = append (self .internalRouter .routes , self .statusService .getRoute ())
159
148
}
160
149
161
150
// start the router
@@ -164,6 +153,9 @@ func (self *ResourceHandler) SetRoutes(routes ...Route) error {
164
153
return err
165
154
}
166
155
156
+ // extra init actions
157
+ self .env = & env {}
158
+
167
159
return nil
168
160
}
169
161
Original file line number Diff line number Diff line change @@ -40,6 +40,16 @@ func newStatusService() *statusService {
40
40
}
41
41
}
42
42
43
+ func (self * statusService ) getRoute () Route {
44
+ return Route {
45
+ HttpMethod : "GET" ,
46
+ PathExp : "/.status" ,
47
+ Func : func (writer * ResponseWriter , request * Request ) {
48
+ self .getStatus (writer , request )
49
+ },
50
+ }
51
+ }
52
+
43
53
func (self * statusService ) update (statusCode int , responseTime * time.Duration ) {
44
54
self .lock .Lock ()
45
55
self .responseCounts [fmt .Sprintf ("%d" , statusCode )]++
You can’t perform that action at this time.
0 commit comments