Skip to content

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

Open
jndlansh wants to merge 1 commit into
eclipse-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 into
eclipse-sw360:mainfrom
jndlansh:fix/file-body-support

Conversation

@jndlansh

@jndlansh jndlansh commented Mar 16, 2026

Copy link
Copy Markdown

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.

Closes: #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
@GMishx GMishx added the has merge conflicts The PR has merge conflicts label Apr 27, 2026

@GMishx GMishx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please rebase with latest main to resolve merge conflicts.

Also, you have not signed the ECA @jndlansh . Without the ECA, we cannot accept any changes from you.

Comment on lines 25 to 27
<properties>
<maven.test.skip>true</maven.test.skip>
<!-- Removed maven.test.skip to allow tests to run -->
</properties>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Checks ran successfully! The entire property can be removed!

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.2</version>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please put the dependency versions in the parent pom as a property

@@ -0,0 +1,71 @@
/*
* Copyright Siemens AG, 2026. Part of the SW360 Portal Project.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for donating the code to Siemens. But you are not a Siemens employee ASAIK, so please update it.

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

Labels

has merge conflicts The PR has merge conflicts 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.

Bug: Native HTTP NewRequestBuilderImpl builds requests with incorrect URI/body/header semantics

2 participants