-
Notifications
You must be signed in to change notification settings - Fork 393
feat: fetch
-Compatible API
#1939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Warning: This pull request is touching the following templated files:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exciting! Just so we don't confuse people, can we keep the request
documentation in the README as well (you can use fetch, or request)? Also, can we create a sample for request as well?
I'll update the README to mention both are available and will be supported long-term - I think we'll want to encourage folks use the |
Gotcha! Maybe we can keep a request sample though and mark it as not recommended? This will also help ensure we don't break the functionality since we run sample tests. |
Description
This will greatly improve ergonomics for customers and our downstream libraries. Notably:
GoogleAuth
/AuthClient
can be a drop-in replacement for libraries requiringfetch
-API complianceHere's an example for customers wanting this functionality:
Impact
Customers can now streamline their request management to:
Testing
Added tests and updated some samples to use
#fetch
.Additional Information
To avoid parsing/marshaling the returned data from
GoogleAuth#fetch
/AuthClient#fetch
toGaxiosResponse#data
, set{responseType: 'stream'}
for theGaxiosOptions
.This can be useful when using this API as a drop-in replacement for
fetch
and the receiving API expectsResponse#bodyUsed
to befalse
.We could expose a
noMarshalFetchData
option here forAuthClientOptions
or upstream inGaxiosOptions
if this becomes a widely-desired feature.Builds on:
fetch
-Compatible API gaxios#680🦕