set query

This commit is contained in:
Andrea Spacca 2021-11-21 19:07:00 +01:00
parent 7a25370548
commit 3824106118

View file

@ -125,13 +125,19 @@ func (*requesthandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
log.Panic(err) log.Panic(err)
} }
proxyURL.RawQuery = q.Encode() proxyURL.RawQuery = ""
for k, v := range q {
for _, vv := range v {
proxyURL.Query().Set(k, vv)
}
}
if strings.HasSuffix(proxyURL.EscapedPath(), "maxres.jpg") { if strings.HasSuffix(proxyURL.EscapedPath(), "maxres.jpg") {
proxyURL.Path = getBestThumbnail(proxyURL.EscapedPath()) proxyURL.Path = getBestThumbnail(proxyURL.EscapedPath())
} }
request, err := http.NewRequest(req.Method, proxyURL.String(), nil) request, err := http.NewRequest(req.Method, proxyURL.String(), nil)
fmt.Println(proxyURL.Query().Encode())
fmt.Println(proxyURL.String()) fmt.Println(proxyURL.String())
copyHeaders(req.Header, request.Header) copyHeaders(req.Header, request.Header)
request.Header.Set("User-Agent", ua) request.Header.Set("User-Agent", ua)