wip: debug

This commit is contained in:
Kevin Franklin Kim 2024-09-26 21:41:10 +02:00
parent 8a91ffb81b
commit 56b9e9b67b
No known key found for this signature in database
2 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,6 @@
package client
import (
"encoding/json"
"errors"
"net/http"
"net/url"
@ -11,6 +10,7 @@ import (
"github.com/foomo/sesamy-go/pkg/encoding/mpv2"
"github.com/foomo/sesamy-go/pkg/provider/cookiebot"
"go.uber.org/zap"
"gopkg.in/yaml.v2"
)
func MPv2MiddlewarConsent(l *zap.Logger) client.MPv2Middleware {
@ -34,7 +34,7 @@ func MPv2MiddlewarConsent(l *zap.Logger) client.MPv2Middleware {
}
var value cookiebot.Cookie
if err := json.Unmarshal([]byte(data), &value); err != nil {
if err := yaml.Unmarshal([]byte(data), &value); err != nil {
l.With(zap.Error(err), zap.String("value", data)).Warn("failed to unmarshal cookie bot cookie")
return next(r, payload)
}

View File

@ -3,13 +3,13 @@ package cookiebot
const CookieName = "CookieConsent"
type Cookie struct {
Stamp string `json:"stamp"`
Necessary bool `json:"necessary"`
Preferences bool `json:"preferences"`
Statistics bool `json:"statistics"`
Marketing bool `json:"marketing"`
Method string `json:"method"`
Version string `json:"ver"`
UTC int `json:"utc"`
Region string `json:"region"`
Stamp string `json:"stamp" yaml:"stamp"`
Necessary bool `json:"necessary" yaml:"necessary"`
Preferences bool `json:"preferences" yaml:"preferences"`
Statistics bool `json:"statistics" yaml:"statistics"`
Marketing bool `json:"marketing" yaml:"marketing"`
Method string `json:"method" yaml:"method"`
Version string `json:"ver" yaml:"ver"`
UTC int `json:"utc" yaml:"utc"`
Region string `json:"region" yaml:"region"`
}