1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: minor code style and cleanup

This commit is contained in:
Ferdinand Mütsch
2023-07-09 20:16:34 +02:00
parent 3063e80692
commit 45a003185e
5 changed files with 43 additions and 41 deletions

View File

@@ -7,6 +7,7 @@ import (
"fmt"
conf "github.com/muety/wakapi/config"
"github.com/muety/wakapi/models"
"github.com/muety/wakapi/utils"
"net/http"
"time"
)
@@ -58,13 +59,10 @@ func (s *MailWhaleSendingService) Send(mail *models.Mail) error {
req.SetBasicAuth(s.config.ClientId, s.config.ClientSecret)
req.Header.Set("Content-Type", "application/json")
res, err := s.httpClient.Do(req)
_, err = utils.RaiseForStatus(s.httpClient.Do(req))
if err != nil {
return err
}
if res.StatusCode >= 400 {
return errors.New(fmt.Sprintf("got status %d from mailwhale", res.StatusCode))
}
return nil
}