瀏覽代碼

v0.3.0-unstable15

Yann Stepienik 2 年之前
父節點
當前提交
a932933550
共有 2 個文件被更改,包括 7 次插入3 次删除
  1. 1 1
      package.json
  2. 6 2
      src/proxy/routerGen.go

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "cosmos-server",
-  "version": "0.3.0-unstable14",
+  "version": "0.3.0-unstable15",
   "description": "",
   "main": "test-server.js",
   "bugs": {

+ 6 - 2
src/proxy/routerGen.go

@@ -39,9 +39,13 @@ func tokenMiddleware(enabled bool, adminOnly bool) func(next http.Handler) http.
 			r.Header.Set("x-cosmos-token", "1234567890")
 
 			if enabled && adminOnly {
-				utils.AdminOnlyWithRedirect(w, r)
+				if errT := utils.AdminOnlyWithRedirect(w, r); errT != nil {
+					return
+				}
 			} else if enabled {
-				utils.LoggedInOnlyWithRedirect(w, r)
+				if errT := utils.LoggedInOnlyWithRedirect(w, r); errT != nil {
+					return
+				}
 			}
 
 			next.ServeHTTP(w, r)