Skip to content

3.3.0

Latest

Choose a tag to compare

@github-actions github-actions released this 11 May 10:23
43b9d87

Release 3.3.0 (#430)

This release improves multipart form-data handling in HTTP requests, specifically ensuring that FormData is properly serialized and sent in API calls. The changes fix a bug where the form-data instance was previously string-coerced (resulting in an invalid request body), and add comprehensive regression tests to prevent this issue from recurring.

HTTP request handling improvements:

  • Added a formDataToBuffer utility to serialize FormData streams into a buffer, ensuring multipart bodies are transmitted correctly in HTTP requests.
  • Updated the HTTP request logic to use the new buffer serialization for FormData, preventing accidental string coercion and ensuring the correct Content-Type and body format.
  • Enhanced header generation to merge headers from FormData instances when present, ensuring the multipart boundary is set correctly.
  • Imported Node's Writable stream to support the new buffer serialization logic.

Testing and regression coverage:

  • Improved and expanded tests in test/files/files.js to verify that multipart requests include the correct fields and headers, and added a regression test for issue #418 to ensure the bug does not reoccur. [1] [2]