npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@denis_bruns/http-angular

v0.1.0

Published

> **An Angular HTTP client implementation with middleware support** > Built on top of Angular’s HttpClient and RxJS, this package provides a type‑safe HTTP client with composable middleware for request configuration and transformation. It leverages core

Readme

@denis_bruns/http-angular

An Angular HTTP client implementation with middleware support
Built on top of Angular’s HttpClient and RxJS, this package provides a type‑safe HTTP client with composable middleware for request configuration and transformation. It leverages core types from @denis_bruns/core and uses middleware from @denis_bruns/http-middleware for a modular, testable HTTP request pipeline.

NPM Version
TypeScript
License: MIT
GitHub


Overview

@denis_bruns/http-angular offers a robust, middleware-driven HTTP client for Angular applications. It wraps Angular’s standard HttpClient to provide:

  • Type‑safe request configurations using interfaces defined in @denis_bruns/core
  • Middleware support so you can inject headers, query parameters, or other modifications before sending a request
  • Helper methods for standard HTTP methods (GET, POST, PUT, PATCH, DELETE) as well as versions that return the full Axios‑like response
  • Seamless integration with other packages in the @denis_bruns ecosystem

Key Features

  • RxJS-based Pipeline:
    All request methods return an Observable, allowing you to compose or transform the HTTP flow using RxJS operators.

  • Middleware Composition:
    Supports a chain of middleware (using @denis_bruns/http-middleware) to modify or enrich request options before the HTTP call executes.

  • Angular Integration:
    Uses Angular's HttpClient for performing actual HTTP requests and converts header objects to Angular’s HttpHeaders.

  • Flexible Request Methods:
    Provides standard methods (get, post, put, patch, delete) along with variants that return full Axios‑like response objects.

  • Query String Serialization:
    Offers utilities to serialize and deserialize filter queries using types from @denis_bruns/core.


Installation

Install via npm:

npm install @denis_bruns/http-angular

Or via yarn:

yarn add @denis_bruns/http-angular

Also ensure you have the following dependencies installed:

npm install @angular/common rxjs @denis_bruns/core @denis_bruns/http-middleware

Basic Usage

Below is an example of how to create and use the Angular HTTP client:

// Import Angular HttpClient (typically provided in an Angular service or component)
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { lastValueFrom } from 'rxjs';
import { HttpClientAngular } from '@denis_bruns/http-angular';
import { HttpClientRequestOptions } from '@denis_bruns/core';

// Example: Custom middleware that adds a header
import { of } from 'rxjs';
import { HttpClientMiddleware } from '@denis_bruns/core';

const addCustomHeaderMiddleware: HttpClientMiddleware<HttpClientRequestOptions> = (config) => {
  return of({
    ...config,
    headers: { ...config.headers, 'X-Custom-Header': 'custom-value' }
  });
};

@Injectable({ providedIn: 'root' })
export class ApiService {
  private client: HttpClientAngular;

  constructor(private http: HttpClient) {
    // Create an instance with a base URL and middleware chain
    this.client = new HttpClientAngular(http, 'https://api.example.com', [addCustomHeaderMiddleware]);
  }

  async getData<T>(endpoint: string): Promise<T> {
    return lastValueFrom(this.client.get<T>(endpoint));
  }

  async createData<T>(endpoint: string, body: Record<string, any>): Promise<T> {
    return lastValueFrom(this.client.post<T, Record<string, any>>(endpoint, body));
  }
}

Explanation

  • HttpClientAngular:
    Wraps Angular’s HttpClient and uses a middleware factory to modify request options before making requests.

  • Middleware:
    You can inject middleware (e.g., addCustomHeaderMiddleware) that will merge with the default configuration. The middleware chain is composed using createHttpClientMiddlewareFactory.

  • Helper Methods:
    The client provides methods like get, post, put, patch, and delete, as well as methods (like getRequest) that return the full response.


Advanced Usage

Returning Full Response

To receive the complete response (not just the data), use methods like getRequest:

async function fetchFullData<T>() {
  const response = await lastValueFrom(httpClient.getRequest<T>('/endpoint'));
  console.log('Status:', response.status);
  console.log('Response headers:', response.headers);
  console.log('Data:', response.data);
}

Middleware Factory

You can compose multiple middleware functions using the provided middleware factory. For example:

import { createHttpClientMiddlewareFactory } from '@denis_bruns/http-middleware';

// Compose your middleware functions (each returns an Observable of HttpClientRequestOptions)
const middleware1$ = of({ headers: { 'X-Test-1': 'value1' } });
const middleware2$ = of({ headers: { 'X-Test-2': 'value2' } });

const combinedMiddleware$ = createHttpClientMiddlewareFactory([middleware1$, middleware2$], { headers: {} });
combinedMiddleware$.subscribe(config => {
  console.log('Final merged config:', config);
});

Related Packages

  • @denis_bruns/core
    NPM
    GitHub
    Provides core interfaces and types for HTTP client configuration and clean architecture.

  • @denis_bruns/http-middleware
    NPM

  • GitHub A middleware framework that integrates with this client to modify HTTP request options.


Contributing

Contributions, enhancements, bug reports, or feature requests are welcome!
Feel free to open an issue or submit a pull request on GitHub.


License

This project is MIT licensed.