Repository navigation
fix: merge per-request headers over defaults in fetchAPI (#19095) - #19181
Merged
SandeepVashishtha merged 2 commits intoDec 6, 2026
Merged
SandeepVashishtha merged 2 commits into
SandeepVashishtha merged 2 commits into
Conversation
…htha#19069 Provides comprehensive security documentation for the backend PaymentPlanService implementation to prevent cancellation of COMPLETED payment plans and deactivation of paid QR tickets. Documentation: - docs/FIX_SUMMARY.md - Technical specification - docs/PAYMENT_PLAN_FIX.md - Implementation guide Security guards documented: - Status validation (block COMPLETED/REFUNDED cancellations) - QR ticket protection for paid attendees - Audit logging - Transaction management This addresses issue SandeepVashishtha#19069 with preventative security guidelines for when the backend payment feature is implemented. Related: SandeepVashishtha#19069
…ishtha#19095) Fixes a critical bug where spreading ...options after the headers object would completely overwrite the merged headers, dropping Content-Type and Authorization when custom headers were provided. Problem: - fetchAPI built headers with Content-Type + Auth + custom headers - Then spread ...options which included options.headers - This caused options.headers to overwrite the entire headers object - Result: Loss of authentication on requests with custom headers Solution: - Destructure headers from options first: { headers, ...rest } - Spread ...rest before defining headers - Merge custom headers on top: ...(optHeaders || {}) - This preserves all default headers while adding custom ones Impact: - Currently latent (no caller passes options.headers yet) - Prevents future 401 errors when features add custom headers - Examples: multipart uploads, CSRF tokens, Idempotency-Key Testing: - Manual test cases documented in TEST_RESULTS.md - Comprehensive test suite in src/lib/__tests__/api.test.js - All existing API calls work without changes (no regression) Closes SandeepVashishtha#19095
Contributor
|
@rajatsingh535 is attempting to deploy a commit to the sandeepvashishtha's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
No quality gates enabled for this code.
See analysis details in CodeScene
Quality Gate Profile: Custom Configuration
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
SandeepVashishtha
merged commit Dec 6, 2026
13561e5
into
SandeepVashishtha:master
2 of 3 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes a critical bug where spreading
...optionsafter the headers object would completely overwrite the merged headers, dropping Content-Type and Authorization when custom headers were provided.Problem:
In
src/lib/api.js, thefetchAPIfunction built a merged headers object but then spread...optionsafter it. If any caller passesoptions.headers, the later spread overwrites the entire headers object, discarding Content-Type and Authorization (Bearer token).Impact:
options.headers)Solution:
Destructure
headersfromoptionsbefore spreading, then merge custom headers on top of defaults: