feat(sub): add HEAD method support for subscription endpoints

Allow clients to retrieve Subscription-Userinfo header via lightweight
HEAD requests without downloading the full response body.
This enables traffic monitoring tools and proxy clients to check quota
usage more efficiently.
This commit is contained in:
spokyle 2026-05-30 16:51:28 +08:00 committed by GitHub
parent eee26e4788
commit f5ad56bfd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -101,13 +101,16 @@ func NewSUBController(
func (a *SUBController) initRouter(g *gin.RouterGroup) { func (a *SUBController) initRouter(g *gin.RouterGroup) {
gLink := g.Group(a.subPath) gLink := g.Group(a.subPath)
gLink.GET(":subid", a.subs) gLink.GET(":subid", a.subs)
gLink.HEAD(":subid", a.subs)
if a.jsonEnabled { if a.jsonEnabled {
gJson := g.Group(a.subJsonPath) gJson := g.Group(a.subJsonPath)
gJson.GET(":subid", a.subJsons) gJson.GET(":subid", a.subJsons)
gJson.HEAD(":subid", a.subJsons)
} }
if a.clashEnabled { if a.clashEnabled {
gClash := g.Group(a.subClashPath) gClash := g.Group(a.subClashPath)
gClash.GET(":subid", a.subClashs) gClash.GET(":subid", a.subClashs)
gClash.HEAD(":subid", a.subClashs)
} }
} }