# angular2-interceptable-http

> Angular2 Http interceptor

Latest version **0.1.2** (published 2016-11-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular2-interceptable-http
pnpm add angular2-interceptable-http
yarn add angular2-interceptable-http
bun add angular2-interceptable-http
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2016-11-23 |
| First published | 2016-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Shota Hoshino |
| Maintainers | hshn |
| Keywords | angular2, http, interceptor |

## Links

- npm: https://www.npmjs.com/package/angular2-interceptable-http
- Repository: https://github.com/hshn/angular2-interceptable-http
- Homepage: https://github.com/hshn/angular2-interceptable-http#readme
- Issues: https://github.com/hshn/angular2-interceptable-http/issues
- npm.io page: https://npm.io/package/angular2-interceptable-http

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2016-11-23
- 0.1.1 — 2016-11-23
- 0.1.0 — 2016-11-23

## README

# angular2-interceptable-http

# Features

 - No need to change `Http` type interface.
 - Predefined interceptors. (PR welcome!)

# Installation

```shell
 npm i angular2-inteceptable-http
```

# Usage

## Import `InterceptableHttpModule`

```js
import { InterceptableHttpModule } from 'angular2-interceptable-http';
import { AppComponent } './app.component';

@NgModule({
  imports: [
    InterceptableHttpModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
```

## Register intercepros using `Provider`

```js
import { InterceptableHttpModule, Interceptor, ClosureInterceptor, UriPrefixInterceptor } from 'angular2-interceptable-http';
import { AppComponent } './app.component';

@NgModule({
  imports: [
    InterceptableHttpModule
  ],
  providers: [{
    provide: Interceptor,
    multi: true
    useValue: ClosureInterceptor.request(request => {
      let { url, body, options } = request;

      // Write interception logic here.

      return { url, body, options }
    })
  }, {
    provide: Interceptor,
    multi: true
    useValue: new UriPrefixInterceptor('http://localhost:8080/api')
  }],
  bootstrap: [AppComponent]
})
export class AppModule { }
```

## Predefined

### UriPrefixInterceptor

```
UriPrefixInterceptor(prefix: string)
```

# TODO

 - [ ] test
 - [ ] doc

---
_Source: https://npm.io/package/angular2-interceptable-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
