nestjs / axios

Axios module for Nest framework (node.js) 🗂

Home Page:https://docs.nestjs.com/techniques/http-module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enable default axios mode with promises instead of observables

kubal5003 opened this issue · comments

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

I'm trying to use axios as explained in axios documentation but instead I'm getting Observables instead of plain old promises from HttpService.

Describe the solution you'd like

I would like to have the choice whether I want to use promise or observable based API for axios.

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

I don't think I should be forced to use axios with only observables, because that is not how axios was built and not how it operates. Maybe there should be separate packages for axios with observables and with promises?

Not sure if you're aware but there is a package axios-observable that does a similar thing with its createObservable vs your implementation of makeObservable.

I don't believe this will change.

Here's an alternative package to @nestjs/axios that doesn't uses observables https://github.com/benhason1/nestjs-http-promise

you can access the underlying axios instance using this.httpService.axiosRef() btw

get axiosRef(): AxiosInstance {
return this.instance;
}

Thanks for your suggestion!

There are no plans to implement it in the foreseeable future.

If you think your request could live outside Nest's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.