Skip to content

angular 16 http request didnt goes through http interceptor #25187

@ooo2003003v2

Description

@ooo2003003v2

Which @angular/* package(s) are the source of the bug?

common

Is this a regression?

Yes

Description

Hello there,

I upgarded my project to angular 16 and use "@angular-devkit/build-angular:browser-esbuild" to build my project. Before the upgarde when my app make a http request it would goes through my http interceptor but after the upgarde the interceptor doesnt seem to work. But when I use"@angular-devkit/build-angular:browser" to build my app, everything works fine. Does anyone what's the issue?

app.module.ts

@NgModule({
    declarations: [AppComponent],
    providers: [
      ...
      { provide: HTTP_INTERCEPTORS, useClass: ApiGatewayInterceptor, multi: true },
   ]
})

ApiGatewayInterceptor

@Injectable()
export class ApiGatewayInterceptor implements HttpInterceptor {

    intercept(req: HttpRequest<any>, next: HttpHandler) {
        console.log('url', req.url);
    }
}

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

_                      _                 ____ _     ___ 
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | | 
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | | 
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 16.0.0
Node: 16.17.0
Package Manager: pnpm 8.4.0
OS: win32 x64

Angular: 16.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... elements, forms, localize, material, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1600.0 (cli-only)
@angular-devkit/build-angular   16.0.0
@angular-devkit/core            16.0.0 (cli-only)
@angular-devkit/schematics      16.0.0 (cli-only)
@schematics/angular             16.0.0 (cli-only)
ng-packagr                      16.0.0
rxjs                            7.8.1
typescript                      5.0.4

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions