mirror of
https://github.com/badkaktus/gorocket.git
synced 2024-12-12 11:15:05 +02:00
hooks edit
This commit is contained in:
parent
47db6f4782
commit
a2ab7a7b8c
9
hooks.go
9
hooks.go
@ -28,10 +28,14 @@ type HookResponse struct {
|
|||||||
func (c *Client) Hooks(msg *HookMessage, token string) (*HookResponse, error) {
|
func (c *Client) Hooks(msg *HookMessage, token string) (*HookResponse, error) {
|
||||||
opt, _ := json.Marshal(msg)
|
opt, _ := json.Marshal(msg)
|
||||||
|
|
||||||
|
url := fmt.Sprintf("%s/hooks/%s", c.baseURL, token)
|
||||||
|
|
||||||
req, err := http.NewRequest("POST",
|
req, err := http.NewRequest("POST",
|
||||||
fmt.Sprintf("%s/hooks/%s", c.baseURL, token),
|
url,
|
||||||
bytes.NewBuffer(opt))
|
bytes.NewBuffer(opt))
|
||||||
|
|
||||||
|
fmt.Println(url)
|
||||||
|
|
||||||
req.Header.Set("Accept", "application/json; charset=utf-8")
|
req.Header.Set("Accept", "application/json; charset=utf-8")
|
||||||
req.Header.Set("Content-Type", "application/json; charset=utf-8")
|
req.Header.Set("Content-Type", "application/json; charset=utf-8")
|
||||||
|
|
||||||
@ -40,9 +44,6 @@ func (c *Client) Hooks(msg *HookMessage, token string) (*HookResponse, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
res, err := c.HTTPClient.Do(req)
|
res, err := c.HTTPClient.Do(req)
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user