Skip to content

Conversation

@gingerbenw
Copy link
Member

@gingerbenw gingerbenw commented Dec 15, 2025

Goal

This PR implements a new plugin to automatically capture and report HTTP errors from web applications. The plugin monitors HTTP requests (both fetch and XHR) and creates structured error reports when responses return configured error status codes.

Design

  • Records comprehensive request/response metadata including:
    • Request: URL, method, headers, body, query parameters
    • Response: status code, headers, body (XHR only)
  • Integrates with @bugsnag/request-tracker to intercept HTTP requests and responses
  • Redacts sensitive data using redactedKeys configuration

Changeset

  • Create new http-errors plugin
  • Add Response data to events in core library

Testing

  • Add unit tests for new functionality
  • Add end to end tests for fetch and xhr requests

@github-actions
Copy link

github-actions bot commented Dec 15, 2025

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 47.74 kB 14.17 kB
After 47.80 kB 14.19 kB
± ⚠️ +61 bytes ⚠️ +15 bytes

code coverage diff

<temporarily disabled>

Generated by 🚫 dangerJS against 172bb79

@gingerbenw gingerbenw force-pushed the PLAT-12567/http-errors-plugin branch from 2a197de to bbe0d77 Compare December 15, 2025 15:04
@gingerbenw gingerbenw changed the base branch from integration/http-errors to PLAT-15268/request-tracker-package December 15, 2025 15:04
@gingerbenw gingerbenw requested a review from Copilot December 15, 2025 15:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@gingerbenw gingerbenw requested a review from Copilot December 15, 2025 16:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Base automatically changed from PLAT-15268/request-tracker-package to integration/http-errors December 15, 2025 16:33
@gingerbenw gingerbenw force-pushed the PLAT-12567/http-errors-plugin branch from 08dfb6f to b7538b7 Compare December 15, 2025 16:35
@gingerbenw gingerbenw force-pushed the PLAT-12567/http-errors-plugin branch from 07a0b8a to ec3e639 Compare December 16, 2025 16:56
@gingerbenw gingerbenw force-pushed the PLAT-12567/http-errors-plugin branch from 5f68f2f to feee16d Compare December 17, 2025 12:29
@gingerbenw gingerbenw force-pushed the PLAT-12567/http-errors-plugin branch from 162ba47 to f1cad91 Compare December 18, 2025 12:07
@gingerbenw gingerbenw requested a review from Copilot December 18, 2025 13:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 39 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gingerbenw gingerbenw requested a review from lemnik December 18, 2025 14:18
@gingerbenw gingerbenw requested a review from Copilot December 19, 2025 09:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 29 out of 38 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gingerbenw gingerbenw marked this pull request as ready for review December 19, 2025 12:28
const requestData = trackedRequests.get(this)
if (requestData) {
requestData.headers = requestData.headers || {}
requestData.headers[String(header)] = String(value)
Copy link
Contributor

@yousif-bugsnag yousif-bugsnag Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each time you call setRequestHeader() after the first time you call it, the value is actually appended to the end of the existing header value, but here we're overwriting it

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.

4 participants