[优化] 自定义不存在页面返回状态码

This commit is contained in:
ryan
2026-06-02 08:14:15 +08:00
parent d21643feed
commit 3825a7f29a
10 changed files with 196 additions and 110 deletions
+9
View File
@@ -104,6 +104,15 @@ func validateOpenRestyOption(key string, value string) error {
trimmed := strings.TrimSpace(value)
switch key {
case "OpenRestyDefaultServerReturnStatus":
if err := validatePositiveIntegerOption(key, trimmed); err != nil {
return err
}
statusCode, _ := strconv.Atoi(trimmed)
if statusCode < 100 || statusCode > 999 {
return fmt.Errorf("%s 必须在 100 到 999 之间", key)
}
return nil
case "OpenRestyWorkerProcesses":
if trimmed == "auto" {
return nil