fix routing
This commit is contained in:
parent
60e4de9afb
commit
208dedeeb6
|
@ -27,14 +27,14 @@ func (reviewAPI *ReviewAPI) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
subPath, subTrail := ShiftPath(r.URL.Path)
|
subPath, subTrail := ShiftPath(r.URL.Path)
|
||||||
subSubPath, _ := ShiftPath(subTrail)
|
subSubPath, _ := ShiftPath(subTrail)
|
||||||
switch {
|
switch {
|
||||||
case r.Method == http.MethodGet && subPath != "":
|
|
||||||
reviewAPI.Get(w, r, subPath)
|
|
||||||
case r.Method == http.MethodGet && subPath == "":
|
case r.Method == http.MethodGet && subPath == "":
|
||||||
reviewAPI.List(w, r)
|
reviewAPI.List(w, r)
|
||||||
case r.Method == http.MethodGet && subPath == "unrated" && subSubPath == "":
|
case r.Method == http.MethodGet && subPath == "unrated" && subSubPath == "":
|
||||||
reviewAPI.ListUnrated(w, r)
|
reviewAPI.ListUnrated(w, r)
|
||||||
case r.Method == http.MethodGet && subPath == "unrated" && subSubPath == "next":
|
case r.Method == http.MethodGet && subPath == "unrated" && subSubPath == "next":
|
||||||
reviewAPI.NextUnrated(w, r)
|
reviewAPI.NextUnrated(w, r)
|
||||||
|
case r.Method == http.MethodGet && subPath != "":
|
||||||
|
reviewAPI.Get(w, r, subPath)
|
||||||
case r.Method == http.MethodPut && subPath != "":
|
case r.Method == http.MethodPut && subPath != "":
|
||||||
reviewAPI.Store(w, r, subPath)
|
reviewAPI.Store(w, r, subPath)
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue