You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
joseglego opened this issue
May 10, 2022
· 1 comment
· Fixed by #619
Assignees
Labels
priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
Is your feature request related to a problem? Please describe.
When using gaxios in my project to connect to Google services, but also to third-party services. I'm connecting to APIS which uses different syntaxis for communication (for example, snake_case) and I'm using camelCase in my project. So, every time I do a request I have to decamelize (transform into snake_case) and when receiving the information I have to camelize it (transform into camelCase)
In general, I'd like to extend gaxios to handle all the requests. So, I don't have to have multiple libraries to do the same.
Describe the solution you'd like
I have used axios previously, and the solution which I found in that tool was being able to create interceptors to responses, but also to requests:
// Add a request interceptoraxios.interceptors.request.use(function(config){// Do something before request is sentreturnconfig;},function(error){// Do something with request errorreturnPromise.reject(error);});// Add a response interceptoraxios.interceptors.response.use(function(response){// Any status code that lie within the range of 2xx cause this function to trigger// Do something with response datareturnresponse;},function(error){// Any status codes that falls outside the range of 2xx cause this function to trigger// Do something with response errorreturnPromise.reject(error);});
More info: https://github.com/axios/axios#interceptors Describe alternatives you've considered
Create one small library/util which will work as a wrap to gaxios, which would process (camelize the data) but also decamelize the response.
priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
Is your feature request related to a problem? Please describe.
When using
gaxios
in my project to connect to Google services, but also to third-party services. I'm connecting to APIS which uses different syntaxis for communication (for example,snake_case
) and I'm usingcamelCase
in my project. So, every time I do a request I have to decamelize (transform intosnake_case
) and when receiving the information I have to camelize it (transform intocamelCase
)In general, I'd like to extend
gaxios
to handle all the requests. So, I don't have to have multiple libraries to do the same.Describe the solution you'd like
I have used
axios
previously, and the solution which I found in that tool was being able to create interceptors to responses, but also to requests:More info: https://github.com/axios/axios#interceptors
Describe alternatives you've considered
Create one small library/util which will work as a wrap to
gaxios
, which would process (camelize the data) but also decamelize the response.Additional context
I have found already this issue:
#181
and read the implementation:
https://github.com/googleapis/gaxios/pull/319/files
but what I noticed is, that adapters are ONLY working for response and not for requests.
The text was updated successfully, but these errors were encountered: