-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Labels
t-toolingIssues with this label are in the ownership of the tooling team.Issues with this label are in the ownership of the tooling team.
Description
Upgrading from [email protected] to [email protected] introduced two breaking changes that require code modifications:
- Import path change: Must use
'impit/index.js'instead of'impit' - Headers format change: Headers must be an array of tuples instead of an object
Issue 1: Import Path Breaking Change
Before (v0.7.4)
import { Impit, type ImpitResponse, type RequestInit } from 'impit';After (v0.8.2)
import { Impit, type ImpitResponse, type RequestInit } from 'impit/index.js';Impact: All imports break and require manual updates across the codebase.
Issue 2: Headers Format Breaking Change
Before (v0.7.4)
const res = await impit.fetch(url, {
headers: {
Accept: '*/*',
'Accept-Language': 'en',
...otherHeaders,
},
});Error when using object format:
Error: Given napi value is not an array on RequestInit.headers
The error indicates that the native bindings expect an array format, but this is not documented and breaks the expected Web API fetch-like interface.
Workaround After (v0.8.2)
Currently using this workaround to maintain object-based header merging:
headers: Object.entries({
Accept: '*/*',
'Accept-Language': 'en',
...init.headers,
}) as [string, string][],Thank you for maintaining this library!
Metadata
Metadata
Assignees
Labels
t-toolingIssues with this label are in the ownership of the tooling team.Issues with this label are in the ownership of the tooling team.