Repository navigation
fix(storage): stop leaking transport options in File.delete() URL - #9977
Open
thiyaguk09 wants to merge 2 commits into
Open
thiyaguk09 wants to merge 2 commits into
thiyaguk09 wants to merge 2 commits into
Conversation
Remove unused responseType and validateStatus transport options (and unreachable 404/403 response checks) from File.delete() so they are not spread into ServiceObject.delete() queryParameters, and add unit test coverage. Fixes googleapis#9874
Contributor
There was a problem hiding this comment.
Code Review
This pull request simplifies the delete method in the File class by delegating directly to the superclass's delete method, removing custom error handling and request option overrides. The corresponding unit tests have been refactored and expanded to cover various scenarios, including verifying that transport options are omitted and testing the behavior of the ignoreNotFound option. Feedback suggests asserting directly on gaxiosOpts.params in the tests to avoid unnecessary URL serialization and parsing, and typing the caught error in assert.rejects as Error & {code?: number} instead of GaxiosError to prevent potential TypeScript compilation or linting errors.
thiyaguk09
marked this pull request as ready for review
November 25, 2026 10:23
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Remove leaked gaxios transport options from
File.delete()query parameters.Impact
Prevents
DELETErequests from sending invalidresponseTypeandvalidateStatusparameters.Changes
responseType: 'text',validateStatus, and unreachable404/403response checks fromFile.delete(), forwardingoptionsdirectly tosuper.delete(options).GaxiosOptionsimport fromhandwritten/storage/src/file.ts.Testing
Filedeleteunit tests inhandwritten/storage/test/file.tsto usesandbox.stub(...)on fresh instances.queryParametersand the serialized outgoingDELETEURL omitresponseType,validateStatus, andignoreNotFound, do not mutate calleroptions, and forwardifGenerationMatch,userProject,generation, and precondition query params.File.delete()tests forignoreNotFound: true(Promise with and withouterr.response, plus callback), non-ignored 404 rejections, andretryOptions.autoRetryrestoration.pnpm run lintandpnpm testinhandwritten/storage.Fixes #9874