Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*BREAKING CHANGE* feature(http): request path interceptors #202

Merged
merged 23 commits into from
Dec 26, 2016

Conversation

emoralesb05
Copy link
Contributor

@emoralesb05 emoralesb05 commented Dec 19, 2016

Description

#194
Path interceptors for http module. There is a need for intercepting certain paths instead of every single request done by the HttpInterceptorService

What's included?

  • code-health unit test for HttpInterceptorService
  • A way to configure interceptors to a specific path they should intercept.

Before:

CovalentHttpModule.forRoot([Interceptor1, Interceptor2]),

After:

CovalentHttpModule.forRoot({
      interceptors: [{
          interceptor: Interceptor1,
          paths: ['**'],
        }, {
          interceptor: Interceptor2,
          paths: ['/apps/*/jobs**', '/logs']
        }],
    }),
  • Updated docs with examples.
  • Updated README.md

Test Steps

  • ng serve
  • ng test

@emoralesb05 emoralesb05 added this to the Alpha 0.10 milestone Dec 20, 2016
@emoralesb05 emoralesb05 changed the title * BREAKING CHANGE * feature(http): request path interceptors *BREAKING CHANGE* feature(http): request path interceptors Dec 20, 2016
@emoralesb05
Copy link
Contributor Author

emoralesb05 commented Dec 21, 2016

New setup:

const httpInterceptorProviders: Type<IHttpInterceptor>[] = [
  CustomInterceptor,
  ...
];

@NgModule({
  imports: [
    HttpModule, /* or CovalentCoreModule.forRoot() */
    CovalentHttpModule.forRoot({
      interceptors: [{
        interceptor: CustomInterceptor, paths: ['**'],
      }],
    }),
    ...
  ],
  providers: [
    httpInterceptorProviders,
    ...
  ],
  ...
})
export class MyModule {}

@kyleledbetter kyleledbetter merged commit 7db377e into develop Dec 26, 2016
@emoralesb05 emoralesb05 deleted the feature/http-interceptor-path branch December 26, 2016 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants