feat(gax): implement uploadChunk in HttpJsonResumableUploadClient - #14140
feat(gax): implement uploadChunk in HttpJsonResumableUploadClient#14140whowes wants to merge 1 commit into
Conversation
faf99d0 to
010c0aa
Compare
010c0aa to
baee7f0
Compare
|
/gemini review |
baee7f0 to
8a6d2fc
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces support for transmitting individual chunks in a resumable upload session by adding ChunkUploadRequest and ChunkUploadResponse classes, implementing uploadChunkCallable() in HttpJsonResumableUploadClient, and adding corresponding unit tests. Feedback was provided to change the HTTP method in UPLOAD_CHUNK_DESCRIPTOR from POST to PUT to comply with the Google Scotty resumable upload protocol.
| private static final ApiMethodDescriptor<ChunkUploadRequest, String> UPLOAD_CHUNK_DESCRIPTOR = | ||
| ApiMethodDescriptor.<ChunkUploadRequest, String>newBuilder() | ||
| .setFullMethodName("ResumableUpload/UploadChunk") | ||
| .setHttpMethod(HttpMethods.POST) |
There was a problem hiding this comment.
The Google Scotty resumable upload protocol specifies that chunk uploads and finalization requests must be sent using the PUT HTTP method, not POST. Using POST will result in 405 Method Not Allowed or other errors when interacting with standard Google APIs like Google Cloud Storage (GCS). Please update the HTTP method to PUT.
| .setHttpMethod(HttpMethods.POST) | |
| .setHttpMethod(HttpMethods.PUT) |
|
|




This handles sending binary chunks and finalize commands over HTTP/JSON, extracting the relevant headers from the response, and handling off-normal response codes (notably HTTP 308 - Resume Incomplete).