Skip to content

Commit

Permalink
downgrade undici to allow for old Next.js and Node.js versions
Browse files Browse the repository at this point in the history
  • Loading branch information
vvo committed Nov 5, 2024
1 parent a6fd11f commit 5bff1ec
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/blob/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"is-buffer": "^2.0.5",
"is-node-process": "^1.2.0",
"throttleit": "^2.1.0",
"undici": "^6.20.1"
"undici": "^5.28.4"
},
"devDependencies": {
"@edge-runtime/jest-environment": "2.3.10",
Expand Down
9 changes: 3 additions & 6 deletions packages/blob/src/xhr.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import type {
Headers as UndiciHeaders,
Response as UndiciResponse,
} from 'undici';
import type { Response as UndiciResponse } from 'undici';
import { isReadableStream, type BlobRequest } from './helpers';
import { debug } from './debug';

Expand Down Expand Up @@ -75,7 +72,7 @@ export const blobXhr: BlobRequest = async ({
status: xhr.status,
statusText: xhr.statusText,
headers,
}) as UndiciResponse;
}) as unknown as UndiciResponse;

resolve(response);
};
Expand All @@ -97,7 +94,7 @@ export const blobXhr: BlobRequest = async ({

// Set headers
if (init.headers) {
const headers = new Headers(init.headers as UndiciHeaders);
const headers = new Headers(init.headers as HeadersInit);
headers.forEach((value, key) => {
xhr.setRequestHeader(key, value);
});
Expand Down
16 changes: 14 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5bff1ec

Please sign in to comment.