all repos — honk @ 6e06b3da023f9d93e3d71c6da0c889e803d06c9c

my fork of honk

debug http client for attachments
Ted Unangst tedu@tedunangst.com
Mon, 27 Jul 2020 00:05:21 -0400
commit

6e06b3da023f9d93e3d71c6da0c889e803d06c9c

parent

9b0730666ce1b53829344d7467d39e7edf894733

1 files changed, 4 insertions(+), 0 deletions(-)

jump to
M activity.goactivity.go

@@ -158,11 +158,15 @@ }

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)