@ngx-stack/merge-http-context
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@ngx-stack/merge-http-context

The utility library for merging multiple Angular HttpContexts.

Install

Install with npm:

$ npm install @ngx-stack/merge-http-context

Usage

import { mergeHttpContext } from "@ngx-stack/merge-http-context";

@Injectable()
export class AppService {
    private cacheContext: HttpContext = new HttpContext().set(CACHE_TOKEN, true);

    constructor(private http: HttpClient) {}

    public getSomething(): Observable<any>{
        return this.http.get(URL, {
            context: mergeHttpContext(
                new HttpContext().set(ID_TOKEN, "some value"),
                CACHE_CONTEXT
            )
        });
    }
}

Package Sidebar

Install

npm i @ngx-stack/merge-http-context

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

64.6 kB

Total Files

12

Last publish

Collaborators

  • damiankuriata