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

feat(connect): add support for File type in requests #3189

Merged

Conversation

cromoteca
Copy link
Contributor

Switches to multipart requests if a File object is found anywhere in the body object.

Closes #3132

Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 95.45455% with 2 lines in your changes missing coverage. Please review.

Project coverage is 86.74%. Comparing base (a1d1c40) to head (040e258).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/ts/frontend/src/Connect.ts 95.45% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3189      +/-   ##
==========================================
+ Coverage   86.69%   86.74%   +0.05%     
==========================================
  Files         120      120              
  Lines        8155     8196      +41     
  Branches     1244     1260      +16     
==========================================
+ Hits         7070     7110      +40     
  Misses       1071     1071              
- Partials       14       15       +1     
Flag Coverage Δ
unittests 86.74% <95.45%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packages/ts/frontend/src/Connect.ts Outdated Show resolved Hide resolved
} else {
headers['Content-Type'] = 'application/json';
body =
params !== undefined ? JSON.stringify(params, (_, value) => (value === undefined ? null : value)) : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

We can make it a bit more readable.

Suggested change
params !== undefined ? JSON.stringify(params, (_, value) => (value === undefined ? null : value)) : undefined;
if (params) {
body = JSON.stringify(params, (_, value) => (value === undefined ? null : value))
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, to make SonarCloud happy, you can wrap repeating test in the function and use it

@cromoteca cromoteca requested a review from Lodin February 4, 2025 08:58
Copy link

sonarqubecloud bot commented Feb 4, 2025

@Lodin Lodin merged commit 40c4ef3 into main Feb 4, 2025
14 checks passed
@Lodin Lodin deleted the feat/3132/Client-support-for-file-upload-with-Hilla-endpoints branch February 4, 2025 09:45
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.

Client support for file upload with Hilla endpoints
2 participants