Skip to content

fix(client): implement file body support for native HTTP request builder#3922

Open
jndlansh wants to merge 1 commit intoeclipse-sw360:mainfrom
jndlansh:fix/file-body-support
Open

fix(client): implement file body support for native HTTP request builder#3922
jndlansh wants to merge 1 commit intoeclipse-sw360:mainfrom
jndlansh:fix/file-body-support

Conversation

@jndlansh
Copy link

Summary of Changes

  • Fixed a bug in the native HTTP request body builder where file uploads were not supported.

  • Implemented file body support in NewRequestBodyBuilderImpl.file(Path, String) using BodyPublishers.ofFile.

  • Added validation for file existence and readability, throwing clear exceptions for missing/unreadable files.

  • Updated unit tests to cover file upload scenarios and skip unreliable permission tests on Windows.

  • This pull request addresses the issue (Bug: Native HTTP NewRequestBuilderImpl builds requests with incorrect URI/body/header semantics #3855 ) where native HTTP client file uploads failed due to an unimplemented method. It solves the problem by providing a robust implementation and proper error handling.

  • Added org.junit.jupiter:junit-jupiter as a test dependency for improved unit testing.

Issue: #3855

Suggest Reviewer

@heliocastro @camillem @YianZhao @kairoaraujo ... kindly review my PR.

How To Test?

  • Run mvn test -pl clients/http-support to verify all unit tests pass.

  • Review the implementation in NewRequestBodyBuilderImpl.java and the test coverage in NewRequestBodyBuilderImplTest.java.

  • Test file upload requests via the native HTTP client path to ensure correct behavior and error handling.

Checklist

Must:

  • All related issues are referenced in commit messages and in PR

Signed-off-by: Ansh Jindal <jndl.ansh@gmail.com>
@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs code review needs general test This is general testing, meaning that there is no org specific issue to check for

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants