You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
What happens when we merge an array (string[][]) into an object? The array indexes become header keys. That's not the correct behaviour—we should instead use the key inside the entries array.
Related: https://github.com/unsplash/unsplash-web/pull/7397
unsplash-js/src/helpers/request.ts
Lines 37 to 40 in 07050e9
The type of the
headers
variable that we're spreading here isHeadersInit | undefined
.HeadersInit
is defined as:What happens when we merge an array (
string[][]
) into an object? The array indexes become header keys. That's not the correct behaviour—we should instead use the key inside the entries array.Desired result:
{ a: 1 }
What happens when we merge a
Headers
class into an object? We lose all data!Desired result:
{ a: 1 }
Related: a lint rule could have caught this typescript-eslint/typescript-eslint#748
The text was updated successfully, but these errors were encountered: