()
| 189 | * Get HTTP request data from the current page. |
| 190 | */ |
| 191 | export function getHttpRequestData(): { url: string; headers: Record<string, string> } { |
| 192 | // grab as much info as exists and add it to the event |
| 193 | const url = getLocationHref(); |
| 194 | const { referrer } = WINDOW.document || {}; |
| 195 | const { userAgent } = WINDOW.navigator || {}; |
| 196 | |
| 197 | const headers = { |
| 198 | ...(referrer && { Referer: referrer }), |
| 199 | ...(userAgent && { 'User-Agent': userAgent }), |
| 200 | }; |
| 201 | const request = { |
| 202 | url, |
| 203 | headers, |
| 204 | }; |
| 205 | |
| 206 | return request; |
| 207 | } |
no test coverage detected