Fix cookiebanner rest API for sdk version <=0.2.0

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-05-07 17:57:00 +04:00
parent 5b1197db9e
commit d1f34add6f
3 changed files with 102 additions and 2 deletions

View File

@@ -71,6 +71,7 @@ func (h *Handler) handleGetConfig(w http.ResponseWriter, r *http.Request) {
}
lang := r.URL.Query().Get("lang")
sdkVersion := r.Header.Get("X-SDK-Version")
cc := h.resolveCountryCode(r)
var regulation cookiebanner.Regulation
@@ -78,7 +79,7 @@ func (h *Handler) handleGetConfig(w http.ResponseWriter, r *http.Request) {
regulation = cookiebanner.RegulationForCountry(*cc)
}
config, err := h.cookieBannerSvc.GetActiveBannerConfig(r.Context(), bannerID, lang, regulation)
config, err := h.cookieBannerSvc.GetActiveBannerConfig(r.Context(), bannerID, lang, regulation, sdkVersion)
if err != nil {
if errors.Is(err, cookiebanner.ErrBannerNotFound) {
jsonutil.RenderNotFound(w, fmt.Errorf("banner not found"))