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