nestjs / axios

Axios module for Nest framework (node.js) 🗂
https://docs.nestjs.com/techniques/http-module
MIT License
220 stars 54 forks source link

Dependency Dashboard #132

Open renovate[bot] opened 3 years ago

renovate[bot] commented 3 years ago

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Config Migration Needed

This repository currently has no open or pending branches.

Detected dependencies

npm
package.json - `@commitlint/cli 19.5.0` - `@commitlint/config-angular 19.5.0` - `@nestjs/common 10.4.7` - `@nestjs/core 10.4.7` - `@nestjs/platform-express 10.4.7` - `@nestjs/testing 10.4.7` - `@types/jest 29.5.14` - `@types/node 22.9.0` - `@typescript-eslint/eslint-plugin 8.13.0` - `@typescript-eslint/parser 8.13.0` - `axios 1.7.7` - `eslint 9.14.0` - `eslint-config-prettier 9.1.0` - `eslint-plugin-import 2.31.0` - `husky 9.1.6` - `jest 29.7.0` - `lint-staged 15.2.10` - `prettier 3.3.3` - `reflect-metadata 0.2.2` - `release-it 17.10.0` - `rimraf 6.0.1` - `rxjs 7.8.1` - `ts-jest 29.2.5` - `typescript 5.6.3` - `@nestjs/common ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0` - `axios ^1.3.1` - `rxjs ^6.0.0 || ^7.0.0`

thgh commented 2 years ago

Is there anything blocking to upgrade Axios to 1.0.0?

FahriDevZ commented 10 months ago

Is there anything blocking to upgrade Axios to 1.0.0?

axios v1 use AbortController instead of Axios.CancelToken.source

maybe HttpService like

export class HttpService {
  // ...

  protected makeObservable<T>(
    axios: (...args: any[]) => AxiosPromise<T>,
    ...args: any[]
  ) {
    return new Observable<AxiosResponse<T>>(subsriber => {
      const config: AxiosRequestConfig = { ...(args[args.length - 1] || {}) };

      let controller: AbortController;
      if (!config.signal) {
        controller = new AbortController();
        config.signal = controller.signal;
      }

      axios(...args)
        .then(res => {
          subsriber.next(res);
          subsriber.complete();
        }).catch(err => {
          subsriber.error(err);
        });

      return () => {
        if (config.responseType === 'stream') {
          return;
        }

        if (controller) {
          controller.abort();
        }
      }
    });
  }
}