1
0
Fork 0

🐛 Fixed invalid host header with broken URI

This commit is contained in:
Maxim Lebedev 2020-02-28 18:00:23 +05:00
parent 858deeef8e
commit d70608c147
No known key found for this signature in database
GPG Key ID: F8978F46FF0FFA4F
1 changed files with 3 additions and 1 deletions

4
bot.go
View File

@ -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()