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 (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/foomo/sesamy-go/pkg/client"
|
"github.com/foomo/sesamy-go/pkg/client"
|
||||||
@ -12,17 +13,20 @@ import (
|
|||||||
|
|
||||||
func MPv2MiddlewarConsent(next client.MPv2Handler) client.MPv2Handler {
|
func MPv2MiddlewarConsent(next client.MPv2Handler) client.MPv2Handler {
|
||||||
return func(r *http.Request, payload *mpv2.Payload[any]) error {
|
return func(r *http.Request, payload *mpv2.Payload[any]) error {
|
||||||
|
fmt.Println("---> 1")
|
||||||
cookie, err := r.Cookie(cookiebot.CookieName)
|
cookie, err := r.Cookie(cookiebot.CookieName)
|
||||||
if err != nil || cookie.Value == "" {
|
if err != nil || cookie.Value == "" {
|
||||||
return next(r, payload)
|
return next(r, payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("---> 2")
|
||||||
data, err := base64.StdEncoding.DecodeString(cookie.Value)
|
data, err := base64.StdEncoding.DecodeString(cookie.Value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return next(r, payload)
|
return next(r, payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
var value cookiebot.Cookie
|
var value cookiebot.Cookie
|
||||||
|
fmt.Println("---> 3")
|
||||||
if err := json.Unmarshal(data, &value); err != nil {
|
if err := json.Unmarshal(data, &value); err != nil {
|
||||||
return next(r, payload)
|
return next(r, payload)
|
||||||
}
|
}
|
||||||
@ -35,6 +39,7 @@ func MPv2MiddlewarConsent(next client.MPv2Handler) client.MPv2Handler {
|
|||||||
return &ret
|
return &ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("---> 4")
|
||||||
payload.Consent = &mpv2.Consent{
|
payload.Consent = &mpv2.Consent{
|
||||||
AdUserData: consent(value.Marketing),
|
AdUserData: consent(value.Marketing),
|
||||||
AdPersonalization: consent(value.Statistics),
|
AdPersonalization: consent(value.Statistics),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user