wip: debug

This commit is contained in:
Kevin Franklin Kim 2024-09-26 21:53:34 +02:00
parent 56b9e9b67b
commit 9673d35bc3
No known key found for this signature in database
2 changed files with 3 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"errors"
"net/http"
"net/url"
"strings"
"github.com/davecgh/go-spew/spew"
"github.com/foomo/sesamy-go/pkg/client"
@ -34,7 +35,7 @@ func MPv2MiddlewarConsent(l *zap.Logger) client.MPv2Middleware {
}
var value cookiebot.Cookie
if err := yaml.Unmarshal([]byte(data), &value); err != nil {
if err := yaml.Unmarshal([]byte(strings.ReplaceAll(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

@ -2,6 +2,7 @@ package cookiebot
const CookieName = "CookieConsent"
// {stamp:'VLZnHUKBPLqZCJyClLLmnGglmUPeZsGxrmiAEZ48i7UH39ptKHY4MA==',necessary:true,preferences:true,statistics:true,marketing:true,method:'explicit',ver:1,utc:1724770548958,region:'de'}
type Cookie struct {
Stamp string `json:"stamp" yaml:"stamp"`
Necessary bool `json:"necessary" yaml:"necessary"`