Merge pull request #717 from ewohltman/develop

Fix for Discord's API returning a 400 Bad Request from empty request body
This commit is contained in:
Carson Hoffman 2019-12-19 13:22:31 -05:00 committed by GitHub
commit 2d5c08be04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,7 +88,12 @@ func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b
req.Header.Set("authorization", s.Token) req.Header.Set("authorization", s.Token)
} }
req.Header.Set("Content-Type", contentType) // Discord's API returns a 400 Bad Request is Content-Type is set, but the
// request body is empty.
if b != nil {
req.Header.Set("Content-Type", contentType)
}
// TODO: Make a configurable static variable. // TODO: Make a configurable static variable.
req.Header.Set("User-Agent", s.UserAgent) req.Header.Set("User-Agent", s.UserAgent)