Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyfill the fetch Headers object if needed #1014

Merged
merged 2 commits into from
Sep 13, 2022

Conversation

waltjones
Copy link
Contributor

Description of the change

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

  • Bug fix (non-breaking change that fixes an issue)

Related issues

Fixes: #1011

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers assigned
  • Issue from task tracker has a link to this pull request
  • Changes have been reviewed by at least one other engineer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error 'Headers undefined' in bundle on IE11
2 participants