[Critical] apiFetch headers spread overwrites Content-Type when custom headers passed #38
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
File: data.jsx:17-22, also js/api.js:14-21
Severity: Critical
...opts is spread AFTER headers, so any caller that passes custom headers in opts replaces the entire Content-Type header instead of extending it. Not triggered yet but will break the first time auth tokens or custom headers are added.
Fix: Move ...opts before headers, or use { ...opts, headers: { 'Content-Type': 'application/json', ...(opts.headers || {}) } }.