mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-07-04 11:52:34 +08:00
Fix subscription user info header handling in SubHandler to only set header on successful fetch
This commit is contained in:
@ -27,11 +27,10 @@ func SubHandler(model M.ClashType, template string) func(c *gin.Context) {
|
|||||||
|
|
||||||
if len(query.Subs) == 1 {
|
if len(query.Subs) == 1 {
|
||||||
userInfoHeader, err := common.FetchSubscriptionUserInfo(query.Subs[0], "clash", config.GlobalConfig.RequestRetryTimes)
|
userInfoHeader, err := common.FetchSubscriptionUserInfo(query.Subs[0], "clash", config.GlobalConfig.RequestRetryTimes)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
c.String(http.StatusInternalServerError, err.Error())
|
|
||||||
}
|
|
||||||
c.Header("subscription-userinfo", userInfoHeader)
|
c.Header("subscription-userinfo", userInfoHeader)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if query.NodeListMode {
|
if query.NodeListMode {
|
||||||
nodelist := M.NodeList{}
|
nodelist := M.NodeList{}
|
||||||
|
Reference in New Issue
Block a user