From 34adc4b8dc8cb354991fd51a66febf319a8b9049 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Mon, 27 Jul 2020 00:05:21 -0400 Subject: [PATCH] debug http client for attachments --- activity.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/activity.go b/activity.go index 951cbd4..905d284 100644 --- a/activity.go +++ b/activity.go @@ -158,11 +158,15 @@ func GetJunkTimeout(url string, timeout time.Duration) (junk.Junk, error) { func fetchsome(url string) ([]byte, error) { client := http.DefaultClient + if debugMode { + client = debugClient + } req, err := http.NewRequest("GET", url, nil) if err != nil { log.Printf("error fetching %s: %s", url, err) return nil, err } + req.Header.Set("User-Agent", "honksnonk/5.0; "+serverName) ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) defer cancel() req = req.WithContext(ctx)