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

Support FormData without known length #2120


Copy link

This PR updates fixes support for FormData instances without known length. In detail:

  • Updated form-data-encoder dependency to version 2.1.0;
  • Fixed usage of headers, returned by FormDataEncoder instance;
  • Added a test for requests using FormData without known length.

Fixes #2111


  • I have read the documentation.
  • I have included a pull request description of my changes.
  • I have included some tests.
  • If it's a new feature, I have included documentation updates in both the README and the types.

@octet-stream octet-stream changed the title Support FormData without known length. Support FormData without known length Aug 25, 2022
Copy link
Contributor Author

octet-stream commented Aug 25, 2022

Some tests are failing, but they are not related to the PR. I don't know why is this happening.
Maybe I did something wrong?

Copy link

Try to rebase from the main branch.

Copy link
Contributor Author

octet-stream commented Sep 2, 2022

Yeh, now it seem to fail because of typescript choosing the last overload for functions.
I will try to fix this later (somehow), because I will likely have more free time this Saturday. Or should we just stick with pify 6.0.0 for this PR?

UPD: I think the fix is rather simple, so I'll do it now as the pify documentation suggests

@@ -68,7 +69,7 @@ const createHttpsTestServer = async (options: HttpsServerOptions = {}): Promise<

await pify(server.https.listen.bind(server.https))();

server.caKey = caKey;
server.caKey = caKey as any;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what the exact meaning of this code, so I just added as any in case if this assignment was without type casting to Buffer by intention. Or should I convert it to Buffer?

source/core/index.ts Show resolved Hide resolved
@szmarczak szmarczak merged commit 850773c into sindresorhus:main Sep 2, 2022
9 checks passed
Copy link

Thanks! ❤️

@octet-stream octet-stream deleted the octet-stream/update-form-data-encoder branch Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

GOT not able to handle Passthrough streams
3 participants