in messaging/messaging_utils.go [211:235]
func validateWebpushConfig(webpush *WebpushConfig) error {
if webpush == nil || webpush.Notification == nil {
return nil
}
dir := webpush.Notification.Direction
if dir != "" && dir != "ltr" && dir != "rtl" && dir != "auto" {
return fmt.Errorf("direction must be 'ltr', 'rtl' or 'auto'")
}
m := webpush.Notification.standardFields()
for k := range webpush.Notification.CustomData {
if _, contains := m[k]; contains {
return fmt.Errorf("multiple specifications for the key %q", k)
}
}
if webpush.FCMOptions != nil {
link := webpush.FCMOptions.Link
p, err := url.ParseRequestURI(link)
if err != nil {
return fmt.Errorf("invalid link URL: %q", link)
} else if p.Scheme != "https" {
return fmt.Errorf("invalid link URL: %q; want scheme: %q", link, "https")
}
}
return nil
}