mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 01:38:30 +02:00
fix(notif): use markdown format if invalid
This commit is contained in:
@@ -30,7 +30,7 @@ var (
|
|||||||
|
|
||||||
// Validate implements the utils.CustomValidator interface.
|
// Validate implements the utils.CustomValidator interface.
|
||||||
func (base *ProviderBase) Validate() gperr.Error {
|
func (base *ProviderBase) Validate() gperr.Error {
|
||||||
if base.Format == nil {
|
if base.Format == nil || base.Format.string == "" {
|
||||||
base.Format = LogFormatMarkdown
|
base.Format = LogFormatMarkdown
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(base.URL, "http://") && !strings.HasPrefix(base.URL, "https://") {
|
if !strings.HasPrefix(base.URL, "http://") && !strings.HasPrefix(base.URL, "https://") {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package notif
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/yusing/go-proxy/internal/gperr"
|
"github.com/yusing/go-proxy/internal/gperr"
|
||||||
@@ -126,5 +125,5 @@ func (e ErrorBody) Format(format *LogFormat) ([]byte, error) {
|
|||||||
case LogFormatMarkdown:
|
case LogFormatMarkdown:
|
||||||
return gperr.Markdown(e.Error), nil
|
return gperr.Markdown(e.Error), nil
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("unknown format: %v", format)
|
return gperr.Markdown(e.Error), nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user