init get handler
()
| 251 | |
| 252 | //init get handler |
| 253 | func (this *restServer) initGetHandler() { |
| 254 | |
| 255 | for k, _ := range this.getMap { |
| 256 | this.router.Get(k, func(w http.ResponseWriter, r *http.Request) { |
| 257 | |
| 258 | var req = make(map[string]interface{}) |
| 259 | var resp map[string]interface{} |
| 260 | |
| 261 | url := this.getPath(r.URL.Path) |
| 262 | if h, ok := this.getMap[url]; ok { |
| 263 | req = this.getParams(r, url, req) |
| 264 | resp = h.handler(req) |
| 265 | resp["Action"] = h.name |
| 266 | } else { |
| 267 | resp = rest.ResponsePack(berr.INVALID_METHOD) |
| 268 | } |
| 269 | this.response(w, resp) |
| 270 | }) |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | //init post handler |
| 275 | func (this *restServer) initPostHandler() { |
no test coverage detected