set query

This commit is contained in:
Andrea Spacca 2021-11-21 19:07:00 +01:00
parent 7a25370548
commit 3824106118
1 changed files with 7 additions and 1 deletions

View File

@ -125,13 +125,19 @@ func (*requesthandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
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") {
proxyURL.Path = getBestThumbnail(proxyURL.EscapedPath())
}
request, err := http.NewRequest(req.Method, proxyURL.String(), nil)
fmt.Println(proxyURL.Query().Encode())
fmt.Println(proxyURL.String())
copyHeaders(req.Header, request.Header)
request.Header.Set("User-Agent", ua)