This repository was archived by the owner on Jan 3, 2026. It is now read-only.
fix: no content response handling when the response type is json#740
Merged
leahecole merged 8 commits intogoogleapis:mainfrom Oct 14, 2025
Merged
fix: no content response handling when the response type is json#740leahecole merged 8 commits intogoogleapis:mainfrom
no content response handling when the response type is json#740leahecole merged 8 commits intogoogleapis:mainfrom
Conversation
no content response handling when the response type is json
Contributor
|
Not sure if it'll be me who reviews, but for whoever does review, adding googleapis/gax-nodejs#1736 as additional context - I think this is pretty similar |
Contributor
Author
|
Just for reference: the same |
708b882 to
dd1ec7d
Compare
Contributor
Author
|
@sofisl please review the PR. |
…to fix-json-error # Conflicts: # test/test.getch.ts
Contributor
Author
|
Returned the |
sofisl
reviewed
Oct 1, 2025
Contributor
Author
|
@ddelgrosso1 can you also check this PR? |
feywind
approved these changes
Oct 9, 2025
feywind
left a comment
There was a problem hiding this comment.
This looks fine to me, though fyi, tagging many people won't help it get reviewed faster. :) We do this stuff on rotation.
leahecole
approved these changes
Oct 14, 2025
Contributor
Author
|
@leahecole Can you release a new version with the bugfix? |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Fixes another regression caused by #617
Before the change json parsing was wrapped in a
try/catchblock and returned empty string in case it failed (line 183in originalgaxios.ts). The change removed the try/catch and just left plainres.json()call.Now when the server returns
204 No Contentresponse with empty body andresponseTypeis set tojsonin request config, gaxios throwsUnexpected end of JSON inputerror.As a possible solution, we now check specifically for
No Contentresponse and just return an empty string in that case like before.Extra test was added to check for this specific case.
Additional Information
Another possible solution could be to return the
try/catchblock instead of targeting204 No Contentresponse specifically.@leahecole please review when you have time.