1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-07-23 13:20:51 +00:00

Compare commits

...

2 commits

2 changed files with 3 additions and 14 deletions

View file

@ -213,6 +213,6 @@ func (c *Client) DeleteReactions(
func (c *Client) DeleteAllReactions(channelID discord.ChannelID, messageID discord.MessageID) error {
return c.FastRequest(
"DELETE",
EndpointChannels+channelID.String()+"/messages/"+messageID.String()+"/reactions/",
EndpointChannels+channelID.String()+"/messages/"+messageID.String()+"/reactions",
)
}

View file

@ -78,25 +78,14 @@ func WithBody(body io.ReadCloser) RequestOption {
// WithJSONBody inserts a JSON body into the request. This ignores JSON errors.
func WithJSONBody(v interface{}) RequestOption {
if v == nil {
return func(httpdriver.Request) error {
return nil
}
return func(httpdriver.Request) error { return nil }
}
var rp, wp = io.Pipe()
var err error
go func() {
err = json.EncodeStream(wp, v)
wp.Close()
}()
go func() { wp.CloseWithError(json.EncodeStream(wp, v)) }()
return func(r httpdriver.Request) error {
// TODO: maybe do something to this?
if err != nil {
return err
}
r.AddHeader(http.Header{
"Content-Type": {"application/json"},
})