Skip to content

Commit

Permalink
feat: allow custom HttpContextToken in ByPassInterceptorBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
Dafnik committed Oct 30, 2023
1 parent ba21cbb commit 1014e7b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions libs/dfx-helper/src/lib/interceptor/by-pass-interceptor.builder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import {HttpContext, HttpContextToken} from '@angular/common/http';
import {BASE_URL_INTERCEPTOR, LOGGING_INTERCEPTOR, POST_PUT_JSON_CONTENT_TYPE_INTERCEPTOR} from './http-context-token';
import {IBuilder} from 'dfts-helper';
import { HttpContext, HttpContextToken } from "@angular/common/http";
import {
BASE_URL_INTERCEPTOR,
LOGGING_INTERCEPTOR,
POST_PUT_JSON_CONTENT_TYPE_INTERCEPTOR
} from "./http-context-token";
import { IBuilder } from "dfts-helper";

export const interceptorByPass = (context?: HttpContext): ByPassInterceptorBuilder => {
return new ByPassInterceptorBuilder().context(context);
Expand Down Expand Up @@ -29,6 +33,11 @@ export class ByPassInterceptorBuilder implements IBuilder<HttpContext> {
return this;
}

custom(token: HttpContextToken<boolean>): this {
this.tokens.push(token);
return this;
}

context(context?: HttpContext): this {
this._context = context;
return this;
Expand Down

0 comments on commit 1014e7b

Please sign in to comment.