Skip to content

feat(gax): add ResumableUploadClient and types for startUpload() - #14127

Closed
whowes wants to merge 1 commit into
whowes/get-first-headerfrom
whowes/resumable-upload-client
Closed

feat(gax): add ResumableUploadClient and types for startUpload()#14127
whowes wants to merge 1 commit into
whowes/get-first-headerfrom
whowes/resumable-upload-client

Conversation

@whowes

@whowes whowes commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

HTTP/JSON client implementation for startUpload is in #14091.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces low-level resumable upload client interfaces and request/session models, including ResumableUploadClient, ResumableUploadSession, and StartUploadRequest, along with their corresponding unit tests. The review feedback suggests improving the path normalization in StartUploadRequest to strip multiple leading slashes rather than just a single one, and adding corresponding test cases to verify this behavior.

Comment on lines +89 to +91
if (getPath() != null && getPath().startsWith("/")) {
setPath(getPath().substring(1));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The current implementation only removes a single leading slash. If the input path contains multiple leading slashes (e.g., //v1/upload), the resulting path will still start with a slash (e.g., /v1/upload), which can lead to malformed URLs or signature mismatches when appended to a base URL.

Consider removing all leading slashes using a regular expression replacement.

Suggested change
if (getPath() != null && getPath().startsWith("/")) {
setPath(getPath().substring(1));
}
String path = getPath();
if (path != null) {
setPath(path.replaceFirst("^/+", ""));
}

Comment on lines +48 to +52
@CsvSource({
"/v1/upload, v1/upload",
"v1/upload, v1/upload",
"/, ''"
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Before adding new test cases for input validation, verify the existing test suite to ensure these scenarios are not already covered. If they are not, add test cases to verify that multiple leading slashes are also correctly normalized and stripped from the path.

  @CsvSource({
    "/v1/upload, v1/upload",
    "//v1/upload, v1/upload",
    "///v1/upload, v1/upload",
    "v1/upload,  v1/upload",
    "/,          ''"
  })
References
  1. Before adding new test cases for input validation (such as non-numeric values or unrecognized properties), verify the existing test suite to ensure these scenarios are not already covered.

@whowes whowes changed the title whowes/resumable upload client feat(gax): add ResumableUploadClient and types for startUpload() Aug 19, 2026
@whowes
whowes force-pushed the whowes/resumable-upload-client branch from 2c264da to c0e396a Compare August 19, 2026 21:57
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@whowes whowes closed this Aug 19, 2026
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.

1 participant