ts-rx-rest
RxJs Http client for Typescript.
Provides convenient typed wrappers for http verbs:
- doGet
- doPost
- doPut
- doDelete
Install
$ npm install --save ts-rx-rest
Since rx 4.* doesn't have @types, you have to manually install rx and define correct typings as follows:
$ npm install --save rx
Create file index.d.ts
along with package.json
with the following content:
/// <reference path="node_modules/rx/ts/rx.all.d.ts" />
Usage
; .wrapRequestwithCredentialsInterceptors // or .withCredentials() .wraperrorInterceptor // forwards an XMLHttpRequest object to an error branch of the observable .wrapjsonInterceptor; // converts text representation of the response to json rest.doGet'/users'.subscribeconsole.logusers;
Custom interceptors
Request interceptors
;
Response interceptors
;