File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export class HttpModule {
27
27
static register ( config : HttpModuleOptions ) : DynamicModule {
28
28
return {
29
29
module : HttpModule ,
30
+ global : config . global ,
30
31
providers : [
31
32
{
32
33
provide : AXIOS_INSTANCE_TOKEN ,
@@ -43,6 +44,7 @@ export class HttpModule {
43
44
static registerAsync ( options : HttpModuleAsyncOptions ) : DynamicModule {
44
45
return {
45
46
module : HttpModule ,
47
+ global : options . global ,
46
48
imports : options . imports ,
47
49
providers : [
48
50
...this . createAsyncProviders ( options ) ,
Original file line number Diff line number Diff line change @@ -6,7 +6,12 @@ import {
6
6
} from '@nestjs/common' ;
7
7
import { AxiosRequestConfig } from 'axios' ;
8
8
9
- export type HttpModuleOptions = AxiosRequestConfig ;
9
+ export type HttpModuleOptions = AxiosRequestConfig & {
10
+ /**
11
+ * Set to true to register HttpModule as a global module
12
+ */
13
+ global ?: boolean ;
14
+ } ;
10
15
11
16
export interface HttpModuleOptionsFactory {
12
17
createHttpOptions ( ) : Promise < HttpModuleOptions > | HttpModuleOptions ;
@@ -20,5 +25,12 @@ export interface HttpModuleAsyncOptions
20
25
...args : any [ ]
21
26
) => Promise < HttpModuleOptions > | HttpModuleOptions ;
22
27
inject ?: FactoryProvider [ 'inject' ] ;
28
+ /**
29
+ * Extra providers to be registered
30
+ */
23
31
extraProviders ?: Provider [ ] ;
32
+ /**
33
+ * Set to true to register HttpModule as a global module
34
+ */
35
+ global ?: boolean ;
24
36
}
You can’t perform that action at this time.
0 commit comments