This commit is contained in:
parent
407d4fb155
commit
94c86d57ff
|
@ -3,6 +3,7 @@ package client
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httputil"
|
"net/http/httputil"
|
||||||
|
@ -83,6 +84,11 @@ func (c *Client) microsubPostRequest(action string, args map[string]string) (*ht
|
||||||
log.Printf("RESPONSE:\n\n%s\n\n", x)
|
log.Printf("RESPONSE:\n\n%s\n\n", x)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if res.StatusCode != 200 {
|
||||||
|
msg, _ := ioutil.ReadAll(res.Body)
|
||||||
|
return nil, fmt.Errorf("unsuccessful response: %d: %q", res.StatusCode, string(msg))
|
||||||
|
}
|
||||||
|
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +110,14 @@ func (c *Client) microsubPostFormRequest(action string, args map[string]string,
|
||||||
|
|
||||||
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.Token))
|
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.Token))
|
||||||
|
|
||||||
return client.Do(req)
|
res, err := client.Do(req)
|
||||||
|
|
||||||
|
if res.StatusCode != 200 {
|
||||||
|
msg, _ := ioutil.ReadAll(res.Body)
|
||||||
|
return nil, fmt.Errorf("unsuccessful response: %d: %q", res.StatusCode, string(msg))
|
||||||
|
}
|
||||||
|
|
||||||
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) ChannelsGetList() ([]microsub.Channel, error) {
|
func (c *Client) ChannelsGetList() ([]microsub.Channel, error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user