-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove undici polyfill (#8729)
- Loading branch information
Showing
12 changed files
with
22 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/telemetry': patch | ||
--- | ||
|
||
Removed an unnecessary dependency. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Node-based adapters now create less server-side javascript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,15 +8,12 @@ import type { OutgoingHttpHeaders } from 'node:http'; | |
* @returns NodeJS OutgoingHttpHeaders object with multiple set-cookie handled as an array of values | ||
*/ | ||
export const createOutgoingHttpHeaders = ( | ||
webHeaders: Headers | undefined | null | ||
headers: Headers | undefined | null | ||
): OutgoingHttpHeaders | undefined => { | ||
if (!webHeaders) { | ||
if (!headers) { | ||
return undefined; | ||
} | ||
|
||
// re-type to access Header.getSetCookie() | ||
const headers = webHeaders as HeadersWithGetSetCookie; | ||
|
||
|
||
// at this point, a multi-value'd set-cookie header is invalid (it was concatenated as a single CSV, which is not valid for set-cookie) | ||
const nodeHeaders: OutgoingHttpHeaders = Object.fromEntries(headers.entries()); | ||
|
||
|
@@ -26,7 +23,8 @@ export const createOutgoingHttpHeaders = ( | |
|
||
// if there is > 1 set-cookie header, we have to fix it to be an array of values | ||
if (headers.has('set-cookie')) { | ||
const cookieHeaders = headers.getSetCookie(); | ||
// @ts-expect-error | ||
const cookieHeaders = headers.getSetCookie() as string[]; | ||
if (cookieHeaders.length > 1) { | ||
// the Headers.entries() API already normalized all header names to lower case so we can safely index this as 'set-cookie' | ||
nodeHeaders['set-cookie'] = cookieHeaders; | ||
|
@@ -35,8 +33,3 @@ export const createOutgoingHttpHeaders = ( | |
|
||
return nodeHeaders; | ||
}; | ||
|
||
interface HeadersWithGetSetCookie extends Headers { | ||
// the @astrojs/webapi polyfill makes this available (as of [email protected]), but tsc doesn't pick it up on the built-in Headers type from DOM lib | ||
getSetCookie(): string[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.