twitch: revert transport settings, hide User-Agent - twitch-go - twitch.tv web application in Go
HTML git clone git://git.codemadness.org/twitch-go
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit a3e1490b334e8f73f01aac63bddd205cc08007b0
DIR parent 4d2a34f1c057adf61d03dee7cf73e5751c8c5fa6
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 6 Apr 2019 22:16:54 +0200
twitch: revert transport settings, hide User-Agent
Diffstat:
M src/twitch/twitch.go | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
---
DIR diff --git a/src/twitch/twitch.go b/src/twitch/twitch.go
@@ -141,21 +141,17 @@ type Videos struct {
}
func ReadAllUrl(url string) ([]byte, error) {
- tr := &http.Transport{
- DisableCompression: true,
- DisableKeepAlives: true,
- MaxIdleConns: 4,
- IdleConnTimeout: 30 * time.Second,
- }
client := http.Client{
- Timeout: time.Duration(30) * time.Second,
- Transport: tr,
+ Timeout: time.Duration(30) * time.Second,
}
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, err
}
+
req.Header.Set("Client-ID", Clientid)
+ req.Header.Set("User-Agent", "")
+
resp, err := client.Do(req)
if resp != nil {
defer resp.Body.Close()