mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-28 07:56:30 +01:00
fix lint issues
This commit is contained in:
@@ -2,6 +2,7 @@ package gotify
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -44,10 +45,6 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
return errors.Wrap(err, "cannot retrieve token secret for Gotify notifier")
|
||||
}
|
||||
|
||||
hc := http.Client{
|
||||
Timeout: *c.cfg.Timeout,
|
||||
}
|
||||
|
||||
message, err := msg.New(msg.Options{
|
||||
Meta: c.meta,
|
||||
Entry: entry,
|
||||
@@ -92,7 +89,11 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
q.Set("token", token)
|
||||
u.RawQuery = q.Encode()
|
||||
|
||||
req, err := http.NewRequest("POST", u.String(), bytes.NewBuffer(jsonBody))
|
||||
hc := http.Client{}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), *c.cfg.Timeout)
|
||||
defer cancel()
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, "POST", u.String(), bytes.NewBuffer(jsonBody))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -105,6 +106,7 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
var errBody struct {
|
||||
|
||||
Reference in New Issue
Block a user