Upgrading from impit@0.7.4 to impit@0.8.2 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!
Upgrading from
impit@0.7.4toimpit@0.8.2introduced two breaking changes that require code modifications:'impit/index.js'instead of'impit'Issue 1: Import Path Breaking Change
Before (v0.7.4)
After (v0.8.2)
Impact: All imports break and require manual updates across the codebase.
Issue 2: Headers Format Breaking Change
Before (v0.7.4)
Error when using object format:
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:
Thank you for maintaining this library!