Skip to content

Remove 278-line dead ScreenshotService and fix fragile FormData Content-Type handling#76

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/remove-dead-screenshot-service
Draft

Remove 278-line dead ScreenshotService and fix fragile FormData Content-Type handling#76
Copilot wants to merge 2 commits intomainfrom
copilot/remove-dead-screenshot-service

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 5, 2026

ScreenshotService was never imported anywhere — screenshot capture lives in the service worker and watermarking in offscreen.ts. buildAuthHeaders always injected Content-Type: application/json, relying on a post-hoc delete in request() to fix it up for FormData uploads — a silent breakage waiting to happen on any pipeline refactor.

Changes

  • Deleted src/services/ScreenshotService.ts — 278 lines of dead code, recoverable from git history if ever needed.
  • ApiClient.buildAuthHeaders — accepts a new options?: { skipContentType?: boolean } parameter; skips setting Content-Type when the caller opts out rather than setting-then-deleting.
  • ApiClient.requestWithAuth — passes skipContentType: true automatically when config.body instanceof FormData, making FormData upload behaviour explicit at the call site.
  • README.md — removed stale ScreenshotService.ts entry from the key files list.
// Before: header set unconditionally, deleted later in request()
private buildAuthHeaders(customHeaders?: Record<string, string>): Record<string, string> {
  return { 'Content-Type': 'application/json', ...customHeaders, ... };
}

// After: caller controls whether Content-Type is included
private buildAuthHeaders(
  customHeaders?: Record<string, string>,
  options?: { skipContentType?: boolean }
): Record<string, string> { ... }

// requestWithAuth now signals intent explicitly
headers: this.buildAuthHeaders(config.headers, { skipContentType: config.body instanceof FormData })

Copilot AI changed the title [WIP] Remove dead ScreenshotService and fix Content-Type header handling Remove 278-line dead ScreenshotService and fix fragile FormData Content-Type handling Apr 5, 2026
Copilot AI requested a review from numbers-official April 5, 2026 11:09
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.

[Feature][High] Remove 278-line dead ScreenshotService and fix fragile Content-Type header handling

2 participants