mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-10-13 13:33:44 +08:00
优化响应中间件,自动识别响应数据格式
This commit is contained in:
@@ -19,17 +19,17 @@ func (s *sMiddleware) Develop(r *ghttp.Request) {
|
||||
}
|
||||
|
||||
if !gstr.InArray(ips, "*") {
|
||||
cuIp := location.GetClientIp(r)
|
||||
clientIp := location.GetClientIp(r)
|
||||
ok := false
|
||||
for _, ip := range ips {
|
||||
if ip == cuIp {
|
||||
if ip == clientIp {
|
||||
ok = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !ok {
|
||||
response.JsonExit(r, gcode.CodeNotSupported.Code(), fmt.Sprintf("当前IP[%s]没有配置生成白名单!", cuIp))
|
||||
response.JsonExit(r, gcode.CodeNotSupported.Code(), fmt.Sprintf("当前IP[%s]没有配置生成白名单!", clientIp))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user