MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / LoadErrCode

Function LoadErrCode

core/utils/security/security.go:117–144  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115}
116
117func LoadErrCode() int {
118 settingRepo := repo.NewISettingRepo()
119 codeVal, err := settingRepo.GetValueByKey("NoAuthSetting")
120 if err != nil {
121 return http.StatusInternalServerError
122 }
123
124 switch codeVal {
125 case "400":
126 return http.StatusBadRequest
127 case "401":
128 return http.StatusUnauthorized
129 case "403":
130 return http.StatusForbidden
131 case "404":
132 return http.StatusNotFound
133 case "408":
134 return http.StatusRequestTimeout
135 case "416":
136 return http.StatusRequestedRangeNotSatisfiable
137 case "500":
138 return http.StatusInternalServerError
139 case "444":
140 return 444
141 default:
142 return http.StatusOK
143 }
144}
145
146func IsFrontendPath(path string) bool {
147 reqUri := strings.TrimSuffix(path, "/")

Callers 1

HandleNotSecurityFunction · 0.85

Calls 1

GetValueByKeyMethod · 0.95

Tested by

no test coverage detected