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

(fix, typescript): multipart form upload on Node 19+ #4056

Merged
merged 27 commits into from
Jul 16, 2024

Conversation

dsinghvi
Copy link
Member

@dsinghvi dsinghvi commented Jul 15, 2024

Fix: This release comes with numerous improvements to multipart uploads:

  1. Fetcher.ts no longer depends on form-data and formdata-node which reduces
    the size of the SDK for all consumers that are not leveraging multipart form
    data uploads.
  2. The SDK now accepts fs.ReadStream, Blob and File as inputs and handles
    parsing them appropriately.
  3. By accepting a Blob as a file parameter, the SDK now supports sending the
    filename when making a request.

@dsinghvi dsinghvi changed the title (fix, typescript): multipart form upload fixes (fix, typescript): multipart form upload on Node 19+ Jul 15, 2024
@dsinghvi dsinghvi marked this pull request as ready for review July 15, 2024 12:29
@RohinBhargava
Copy link
Contributor

RohinBhargava commented Jul 16, 2024

Node test outputs:

rohinbhargava@Rohins-MacBook-Pro-2 tmp-14501-VC27csybtudO % nvm use 16
Now using node v16.20.2 (npm v8.19.4)
rohinbhargava@Rohins-MacBook-Pro-2 tmp-14501-VC27csybtudO % ts-node index.ts
{ documentId: '12a61b8c-da81-4c06-8fee-877e81275fc9' }
rohinbhargava@Rohins-MacBook-Pro-2 tmp-14501-VC27csybtudO % nvm use 17      
Now using node v17.9.1 (npm v8.11.0)
rohinbhargava@Rohins-MacBook-Pro-2 tmp-14501-VC27csybtudO % ts-node index.ts
{ documentId: '12a61b8c-da81-4c06-8fee-877e81275fc9' }
rohinbhargava@Rohins-MacBook-Pro-2 tmp-14501-VC27csybtudO % nvm use 18
Now using node v18.17.0 (npm v9.6.7)
rohinbhargava@Rohins-MacBook-Pro-2 tmp-14501-VC27csybtudO % ts-node index.ts
{ documentId: '12a61b8c-da81-4c06-8fee-877e81275fc9' }
rohinbhargava@Rohins-MacBook-Pro-2 tmp-14501-VC27csybtudO % nvm use 19
Now using node v19.9.0 (npm v9.6.3)
rohinbhargava@Rohins-MacBook-Pro-2 tmp-14501-VC27csybtudO % ts-node index.ts
{ documentId: '12a61b8c-da81-4c06-8fee-877e81275fc9' }
rohinbhargava@Rohins-MacBook-Pro-2 tmp-14501-VC27csybtudO % nvm use 20
Now using node v20.4.0 (npm v9.7.2)
rohinbhargava@Rohins-MacBook-Pro-2 tmp-14501-VC27csybtudO % ts-node index.ts
{ documentId: '12a61b8c-da81-4c06-8fee-877e81275fc9' }

On browser, failure to fetch due to CORS blocking from server, but call made:
image

@@ -94,6 +94,7 @@ export declare namespace Fetcher {
withCredentials: boolean;
timeoutInSeconds: ts.Expression;
maxRetries?: ts.Expression;
requestType?: "json" | "file" | "bytes" | "other";
Copy link
Member Author

Choose a reason for hiding this comment

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

should we remove other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants