@angular-ru/cdk/http

DataHttpClient

Custom http client, with the ability to customize requests, auto unsubscribe and additional request interceptors.

Table of contents:

First step

Example, if your API base url placed here https://my-server.com/api/*** and have swagger documentation:

Create your http client for your api controller

  • user.interface.ts

  • api-users.client.ts

  • app.component.ts

Different use cases

each of these examples works the same

Limiting the number of concurrent requests (optional)

Option
Value
Description

limitConcurrency

255

default

limitConcurrency

Infinity

no limits

limitConcurrency

n

only n requests

there is almost no limit on the number of requests that can be sent in parallel Note: various browsers have various limits for maximum connections per host name (Chrome: 6)

but if necessary, you can change it for example, limitConcurrency: 5 This mean that maximum of 5 requests can be executed in parallel. Next one immediately start only if one of the previous requests is completed

  • app.config.ts

@angular-ru/cdk/http/decorators

  • @RestClient(url)

  • @BaseUrl(url)

  • @HostUrl(url)

  • @Get(url), @Post(url), @Put(url), @Delete(url), @Patch(url)

  • @RequestParam(key)

  • @PathVariable(key)

  • @RequestBody()

@angular-ru/cdk/http/utils

  • isLocalhost

  • getPathWithoutQueryParams

  • getUrlSegments

  • isAbsolutePath

  • replaceDoubleSlash

  • replaceLeadingAndTrailingSlashes

  • urlParse

  • getHttpHeader

  • parseQueryParams

  • getHttpParams

Last updated