mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:38:50 +02:00
Feat/ntfy (#57)
* implement ntfy notification * fix notification fields order * fix schema for ntfy --------- Co-authored-by: yusing <yusing@6uo.me>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package notif
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
@@ -54,3 +55,15 @@ func (base *ProviderBase) GetMethod() string {
|
||||
func (base *ProviderBase) GetMIMEType() string {
|
||||
return "application/json"
|
||||
}
|
||||
|
||||
func (base *ProviderBase) SetHeaders(logMsg *LogMessage, headers http.Header) {
|
||||
// no-op by default
|
||||
}
|
||||
|
||||
func (base *ProviderBase) makeRespError(resp *http.Response) error {
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err == nil {
|
||||
return E.Errorf("%s status %d: %s", base.Name, resp.StatusCode, body)
|
||||
}
|
||||
return E.Errorf("%s status %d", base.Name, resp.StatusCode)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user