refactor
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user