Closed yousif-bugsnag closed 7 months ago
NPM build
Package | |
---|---|
Before | 183.98 kB |
After | 183.98 kB |
± | No change |
CDN build
Unminified | Minfied | Minified + gzipped | |
---|---|---|---|
Before | 91.76 kB |
34.46 kB |
10.41 kB |
After | 92.67 kB |
34.77 kB |
10.48 kB |
± | +905 bytes ⚠️ |
+312 bytes ⚠️ |
+74 bytes ⚠️ |
Ok | File (✨=New File) | Lines | Branches | Functions | Statements |
---|---|---|---|---|---|
🔴 | /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/request-tracker/lib/request-tracker-fetch.ts | 73.58% (-11.26%) |
54.9% (-2.67%) |
55% (-15%) |
60.56% (-9.2%) |
Total:
Lines | Branches | Functions | Statements |
---|---|---|---|
87.58%(-0.39%) | 78.62%(-0.83%) | 88.14%(-1.1%) | 84.21%(-0.57%) |
Generated against 3de148a55a2382345a82bbecd6d535b88cf1ca62 on 12 April 2024 at 11:39:39 UTC
Goal
Fixes a bug in the fetch request tracker where any headers that are set in a
Request
object passed tofetch
were not being preserved. Similarly if headers are set using theHeaders
class in the request options these would also be wiped.This is because trace propagation headers were always being merged with the options object (the second argument passed to fetch) as an object literal, however request headers can be set in a few different ways:
Headers
instance in optionsRequest
object passed as the first argument tofetch
The behaviour of
fetch
is such that if headers are set in the options object these will take precedence, and any headers defined in aRequest
object are ignored.Design
Reworked the
mergeRequestHeaders
logic to handle all of the cases listed above, with headers defined infetch
options taking precedence.Testing
Added additional unit test cases and e2e scenarios