mirror of
https://github.com/foomo/sesamy-go.git
synced 2025-10-16 12:35:43 +00:00
wip: debug
This commit is contained in:
parent
7468cd8508
commit
fcb18a0799
@ -3,6 +3,7 @@ package client
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/foomo/sesamy-go/pkg/client"
|
||||
@ -12,17 +13,20 @@ import (
|
||||
|
||||
func MPv2MiddlewarConsent(next client.MPv2Handler) client.MPv2Handler {
|
||||
return func(r *http.Request, payload *mpv2.Payload[any]) error {
|
||||
fmt.Println("---> 1")
|
||||
cookie, err := r.Cookie(cookiebot.CookieName)
|
||||
if err != nil || cookie.Value == "" {
|
||||
return next(r, payload)
|
||||
}
|
||||
|
||||
fmt.Println("---> 2")
|
||||
data, err := base64.StdEncoding.DecodeString(cookie.Value)
|
||||
if err != nil {
|
||||
return next(r, payload)
|
||||
}
|
||||
|
||||
var value cookiebot.Cookie
|
||||
fmt.Println("---> 3")
|
||||
if err := json.Unmarshal(data, &value); err != nil {
|
||||
return next(r, payload)
|
||||
}
|
||||
@ -35,6 +39,7 @@ func MPv2MiddlewarConsent(next client.MPv2Handler) client.MPv2Handler {
|
||||
return &ret
|
||||
}
|
||||
|
||||
fmt.Println("---> 4")
|
||||
payload.Consent = &mpv2.Consent{
|
||||
AdUserData: consent(value.Marketing),
|
||||
AdPersonalization: consent(value.Statistics),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user