Skip to content

Commit

Permalink
feat: make it optional
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed Jun 30, 2020
1 parent ea6e2ab commit 63dfe46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions adonis-typings/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ declare module '@ioc:Adonis/Core/Request' {
allowMethodSpoofing: boolean,
getIp?: ((request: RequestContract) => string),
trustProxy: (address: string, distance: number) => boolean,
enableAsyncHttpContext?: boolean,
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ export class Server implements ServerContract {
}

private getAsyncContext (ctx: HttpContextContract): InternalAsyncHttpContext | null {
// TODO: check if async context is activated, return null if not.
return new InternalAsyncHttpContext(ctx)
if (this.httpConfig.enableAsyncHttpContext) {
return new InternalAsyncHttpContext(ctx)
}
return null
}

/**
Expand Down

0 comments on commit 63dfe46

Please sign in to comment.