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
Transitioning from request #249
Comments
Greetings! We can take a look at this in a bit, but for now, have you considered using teeny-request? It was written to be mostly API compatible with |
That looks interesting! However I'd prefer a library that does async/await out of the box (request doesn't, but I use a wrapper... bit clunky though). Would also be useful to have your input on the following: https://stackoverflow.com/q/60532289/4070848 Perhaps I'm being too optimistic to hope for something that does everything that request does (only better)! Thanks! |
@JustinBeckwith sure you're busy but would be great to have even some brief response on this one. Would be useful to all I'm sure. Thanks! |
👋 thanks for the bump
Yes! We're using node-fetch under the hood, so that option is enabled by default.
As of now I don't think you can 😆 We could certainly add this option if it was a big deal (easy enough). If we chose to support it, I would probably use the
All of those were correct
At the end of the day, that's just a header right? So you should be able to set: gaxios.request({
url: '...',
headers: {
auth: 'bearer xxxxx'
},
});
It does this by default! The response you get back from the promise is the full response. The body is in Hope this helps! |
Super helpful, thanks! |
@JustinBeckwith having been migrating the Perhaps there is justification for an additional I note that axios has an It appears that both request's and axios's implementation deals with
where:
see e.g. here. In addition, request's implementation (but not axios's) deals with the
So having the |
Makes sense. Just to set expectations, we're not likely to add this any time soon - but thank you for digging! |
Yep, no worries... I've already done the manual conversion into appropriate Authorisation headers so likely I wouldn't use an |
@JustinBeckwith on the same topic of transitioning from request... can gaxios do something equivalent to what is possible with request as described here and here? |
Yes! I don't know if we documented this but: |
So what would the gaxios equivalent of |
@JustinBeckwith any hints on my question just above? I'll give the first one a go myself:
What about the second one, i.e. the gaxios equivalent of:
This is used for example in this sort of context. Or in the following context, to redirect a request (whether it be a
|
@JustinBeckwith sure you're busy, but would be great to know the answer to the above question on piping into and out of |
I'm coming to
gaxios
fromrequest
. In the latter I'm used to specifyinggzip: true
in my request options, to ensure compression is used in the response (if available). This does not appear to be available ingaxios
so I'm wondering if it is effectively enabled by default? Not that I'd ever want to, but is it possible ingaxios
to disable compression?And it seems to me that the following drop-in replacements can also be made when transitioning from
request
togaxios
... please correct me if I'm wrong!json: true
becomesresponseType: 'json'
(though this is the default anyway so could be omitted)body: { a: x, b: y }
becomesdata: { a: x, b: y }
qs: { a: x, b: y }
becomesparams: { a: x, b: y }
What about an equivalent for
auth: { bearer: bearerToken }
? See here.And an equivalent to
resolveWithFullResponse
? See here.The text was updated successfully, but these errors were encountered: