Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add required duplex option to RequestInit #7

Merged
merged 1 commit into from
May 3, 2023

Conversation

Benzolio
Copy link
Contributor

@Benzolio Benzolio commented May 3, 2023

see also nodejs/node#46221 and microsoft/TypeScript-DOM-lib-generator#1483

This will prevent the following runtime error:

TypeError: RequestInit: duplex option is required when sending a body.
    at new Request (node:internal/deps/undici/undici:7184:19)
    at createNodeRequest (...node_modules/authey/dist/index.mjs:32:10)

This is the fix as suggested by @KararTY in Issue #4

I can confirm vitest passes, the typecheck does fail, but for the known reason that microsoft/TypeScript-DOM-lib-generator#1483 mentions regarding the incomplete type in their spec which has fallen behind the actual node implementation.

With the single line added for duplex: 'half', the build in dist works without errors when imported into an Express app and used as middleware.

(PR previously submitted as #6)

@wobsoriano
Copy link
Owner

Thanks!

@wobsoriano wobsoriano merged commit abe1c25 into wobsoriano:main May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants