({
app,
url,
cookies,
pathname,
}: GetBootDataParams)
| 155 | } |
| 156 | |
| 157 | export async function getBootData({ |
| 158 | app, |
| 159 | url, |
| 160 | cookies, |
| 161 | pathname, |
| 162 | }: GetBootDataParams): Promise<Boot> { |
| 163 | const bootURL = getBootURL(app, url, pathname); |
| 164 | // Persisted by the CMP in the euconsent-v2 cookie on a previous page view — |
| 165 | // the CMP script loads after boot fires, so the live __tcfapi is never |
| 166 | // available here. |
| 167 | const tcString = getStoredTcString(); |
| 168 | const res = await fetch(bootURL, { |
| 169 | method: 'GET', |
| 170 | credentials: 'include', |
| 171 | headers: { |
| 172 | app, |
| 173 | 'Content-Type': 'application/json', |
| 174 | ...(tcString && { 'x-gdpr-consent': tcString }), |
| 175 | ...(cookies && { Cookie: cookies }), |
| 176 | }, |
| 177 | }); |
| 178 | const result = await res.json(); |
| 179 | return enrichBootWithFeatures(result); |
| 180 | } |
no test coverage detected