Send SDK version as X-SDK-Version header
Move the cookie-banner SDK version from the POST consents request body to a custom X-SDK-Version header sent on every API call. The server now reads it from the header and the CORS middleware allows it through preflight. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -288,7 +288,6 @@ export class CookieBannerClient {
|
||||
version: cfg.version,
|
||||
action,
|
||||
consent_data: consentData,
|
||||
sdk_version: __SDK_VERSION__,
|
||||
};
|
||||
void fetchJSON<ConsentRecord>(url, { method: "POST", body })
|
||||
.then(() => void flush(this.bannerId))
|
||||
|
||||
@@ -120,6 +120,7 @@ export async function fetchJSON<T>(
|
||||
credentials: "omit",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"X-SDK-Version": __SDK_VERSION__,
|
||||
...(body !== undefined && { "Content-Type": "application/json" }),
|
||||
...headers,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user