Skip to content

Extract _canSendReplay into its own private ReplayManager static function#1343

Merged
matux merged 1 commit into
masterfrom
matux/can-send-replay
Oct 2, 2025
Merged

Extract _canSendReplay into its own private ReplayManager static function#1343
matux merged 1 commit into
masterfrom
matux/can-send-replay

Conversation

@matux

@matux matux commented Oct 2, 2025

Copy link
Copy Markdown
Contributor

Description of the change

Extracted _canSendReplay as a testable static method with header normalization in ReplayManager.

@matux matux requested a review from Copilot October 2, 2025 17:23
@matux matux self-assigned this Oct 2, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR extracts replay validation logic into a dedicated static method to improve testability and maintainability. The _canSendReplay method centralizes the logic for determining whether a replay can be sent based on API response and headers.

  • Extracted inline replay validation logic into ReplayManager._canSendReplay static method
  • Added header normalization to handle case-insensitive headers and whitespace trimming
  • Comprehensive test coverage for the new static method including edge cases

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/browser/replay/replayManager.js Added static _canSendReplay method with header normalization and refactored sendOrDiscardReplay to use it
test/replay/unit/replayManager.test.js Added comprehensive test suite for the new _canSendReplay method covering various scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@matux matux merged commit 78bfeb8 into master Oct 2, 2025
4 checks passed
@matux matux deleted the matux/can-send-replay branch October 2, 2025 17:47
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.

3 participants