The network telemetry code paths rely on the standard Headers object for case insensitive handling of request headers. While Headers is part of the fetch API standard, and has been included in browser implementations since fetch was first introduced, there are some fetch polyfills that don't implement Headers.
This PR uses a minimal polyfill when Headers is undefined. Though referred to here as a "polyfill", it is not added to the window object and does not replace or export any global functionality. It is only used internally by Rollbar.js.
Notes:
This is implemented in Rollbar.js in order to not take a new dependency.
The implementation is as minimal as possible to keep package size small.
Users of the componentized build who do not include telemetry will see no change in package size.
Type of change
[x] Bug fix (non-breaking change that fixes an issue)
Description of the change
The network telemetry code paths rely on the standard
Headers
object for case insensitive handling of request headers. WhileHeaders
is part of the fetch API standard, and has been included in browser implementations since fetch was first introduced, there are some fetch polyfills that don't implementHeaders
.This PR uses a minimal polyfill when
Headers
is undefined. Though referred to here as a "polyfill", it is not added to the window object and does not replace or export any global functionality. It is only used internally by Rollbar.js.Notes:
Type of change
Related issues
Fixes: https://github.com/rollbar/rollbar.js/issues/1011
Development
Code review