From d70608c147c0b6dae31430f304abe7da3e8ef0a7 Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Fri, 28 Feb 2020 18:00:23 +0500 Subject: [PATCH] :bug: Fixed invalid host header with broken URI --- bot.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bot.go b/bot.go index 8314a39..bd2d40f 100644 --- a/bot.go +++ b/bot.go @@ -60,9 +60,11 @@ func (b Bot) Do(method string, payload interface{}) ([]byte, error) { req := http.AcquireRequest() defer http.ReleaseRequest(req) + req.Header.SetUserAgent("toby3d/telegram") req.Header.SetMethod(http.MethodPost) - req.SetRequestURIBytes(u.RequestURI()) req.Header.SetContentType("application/json") + req.SetHostBytes(u.Host()) + req.SetRequestURI(u.String()) req.SetBody(buf.Bytes()) resp := http.AcquireResponse()