kim 4 年之前
父節點
當前提交
44290aa4d6
共有 3 個文件被更改,包括 3 次插入4 次删除
  1. 0 1
      rest/httpx/responses.go
  2. 1 1
      tools/goctl/api/gogen/genhandlers.go
  3. 2 2
      tools/goctl/api/gogen/genroutes.go

+ 0 - 1
rest/httpx/responses.go

@@ -12,7 +12,6 @@ func Error(w http.ResponseWriter, err error) {
 }
 }
 
 
 func Ok(w http.ResponseWriter) {
 func Ok(w http.ResponseWriter) {
-	w.Header().Set("Content-Type", "text/plain; charset=utf-8")
 	w.WriteHeader(http.StatusOK)
 	w.WriteHeader(http.StatusOK)
 }
 }
 
 

+ 1 - 1
tools/goctl/api/gogen/genhandlers.go

@@ -71,7 +71,7 @@ func genHandler(dir string, group spec.Group, route spec.Route) error {
 	if len(route.RequestType.Name) == 0 {
 	if len(route.RequestType.Name) == 0 {
 		req = ""
 		req = ""
 	}
 	}
-	var logicResponse = ""
+	var logicResponse string
 	var writeResponse = "nil, nil"
 	var writeResponse = "nil, nil"
 	var respWriter = `httpx.WriteJson(w, http.StatusOK, resp)`
 	var respWriter = `httpx.WriteJson(w, http.StatusOK, resp)`
 	if len(route.ResponseType.Name) > 0 {
 	if len(route.ResponseType.Name) > 0 {

+ 2 - 2
tools/goctl/api/gogen/genroutes.go

@@ -77,11 +77,11 @@ func genRoutes(dir string, api *spec.ApiSpec) error {
 		},`,
 		},`,
 				r.method, r.path, r.handler)
 				r.method, r.path, r.handler)
 		}
 		}
-		jwt := ""
+		var jwt string
 		if g.jwtEnabled {
 		if g.jwtEnabled {
 			jwt = fmt.Sprintf(", ngin.WithJwt(serverCtx.Config.%s.AccessSecret)", g.authName)
 			jwt = fmt.Sprintf(", ngin.WithJwt(serverCtx.Config.%s.AccessSecret)", g.authName)
 		}
 		}
-		signature := ""
+		var signature string
 		if g.signatureEnabled {
 		if g.signatureEnabled {
 			signature = fmt.Sprintf(", ngin.WithSignature(serverCtx.Config.%s.Signature)", g.authName)
 			signature = fmt.Sprintf(", ngin.WithSignature(serverCtx.Config.%s.Signature)", g.authName)
 		}
 		}