mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 03:32:33 +08:00
fix: method in vmess http-opts is not used
This commit is contained in:
parent
78d945470d
commit
4bd0692f05
8
common/util/manipulation.go
Normal file
8
common/util/manipulation.go
Normal file
|
@ -0,0 +1,8 @@
|
|||
package util
|
||||
|
||||
import "github.com/samber/lo"
|
||||
|
||||
func EmptyOr[T comparable](v T, def T) T {
|
||||
ret, _ := lo.Coalesce(v, def)
|
||||
return ret
|
||||
}
|
|
@ -8,6 +8,8 @@ import (
|
|||
"net/http"
|
||||
"net/textproto"
|
||||
|
||||
"github.com/Dreamacro/clash/common/util"
|
||||
|
||||
"github.com/zhangyunhao116/fastrand"
|
||||
)
|
||||
|
||||
|
@ -59,7 +61,7 @@ func (hc *httpConn) Write(b []byte) (int, error) {
|
|||
}
|
||||
|
||||
u := fmt.Sprintf("http://%s%s", host, path)
|
||||
req, _ := http.NewRequest("GET", u, bytes.NewBuffer(b))
|
||||
req, _ := http.NewRequest(util.EmptyOr(hc.cfg.Method, http.MethodGet), u, bytes.NewBuffer(b))
|
||||
for key, list := range hc.cfg.Headers {
|
||||
req.Header.Set(key, list[fastrand.Intn(len(list))])
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user