mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-07-27 16:01:50 +00:00
Compare commits
No commits in common. "0cb65e88a8d972925352b8b41f10f6869f298a28" and "1202a17359da473e611d265bc7698679b04624ee" have entirely different histories.
0cb65e88a8
...
1202a17359
|
@ -213,6 +213,6 @@ func (c *Client) DeleteReactions(
|
||||||
func (c *Client) DeleteAllReactions(channelID discord.ChannelID, messageID discord.MessageID) error {
|
func (c *Client) DeleteAllReactions(channelID discord.ChannelID, messageID discord.MessageID) error {
|
||||||
return c.FastRequest(
|
return c.FastRequest(
|
||||||
"DELETE",
|
"DELETE",
|
||||||
EndpointChannels+channelID.String()+"/messages/"+messageID.String()+"/reactions",
|
EndpointChannels+channelID.String()+"/messages/"+messageID.String()+"/reactions/",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,14 +78,25 @@ func WithBody(body io.ReadCloser) RequestOption {
|
||||||
// WithJSONBody inserts a JSON body into the request. This ignores JSON errors.
|
// WithJSONBody inserts a JSON body into the request. This ignores JSON errors.
|
||||||
func WithJSONBody(v interface{}) RequestOption {
|
func WithJSONBody(v interface{}) RequestOption {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return func(httpdriver.Request) error { return nil }
|
return func(httpdriver.Request) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var rp, wp = io.Pipe()
|
var rp, wp = io.Pipe()
|
||||||
|
var err error
|
||||||
|
|
||||||
go func() { wp.CloseWithError(json.EncodeStream(wp, v)) }()
|
go func() {
|
||||||
|
err = json.EncodeStream(wp, v)
|
||||||
|
wp.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
return func(r httpdriver.Request) error {
|
return func(r httpdriver.Request) error {
|
||||||
|
// TODO: maybe do something to this?
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
r.AddHeader(http.Header{
|
r.AddHeader(http.Header{
|
||||||
"Content-Type": {"application/json"},
|
"Content-Type": {"application/json"},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue