Fix for Discord's API returning a 400 Bad Request if Content-Type is set, but the request body is empty.
This commit is contained in:
parent
9a0071df7e
commit
307c335eb6
1 changed files with 6 additions and 1 deletions
|
@ -88,7 +88,12 @@ func (s *Session) RequestWithLockedBucket(method, urlStr, contentType string, b
|
|||
req.Header.Set("authorization", s.Token)
|
||||
}
|
||||
|
||||
// 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.
|
||||
req.Header.Set("User-Agent", s.UserAgent)
|
||||
|
||||
|
|
Loading…
Reference in a new issue