
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
rxjs-http-cl
Advanced tools
A simple to use http client built on ES6 fetch and RxJS.
Version 1.5.4 is the latest stable version.
You can use NPM or Yarn to install this package
yarn add rxjs-http-client
npm i rxjs-http-client
Using rxjs-http-client is very simple.
To get started you are required to create a new instance of the RxJSHttpClient class as shown below:
class SomeClass {
_http;
constructor() {
this._http = new RxJSHttpClient();
}
}
The get method provides you with the ability to make a HTTP GET request.
This method has two parameters, the first parameter is the request url and the second optional parameter is the HTTP config object.
This method returns an observable container a HTTP response object.
Example of basic usage is shown below:
class SomeClass {
_http;
constructor() {
this._http = new RxJSHttpClient();
}
getRequest() {
this._http.get('some-url')
.pipe(
mergeMap((response) => response.json())
)
.subscribe((response) => {
console.log(response)
})
}
}
The post method provides you with the ability to make a HTTP POST request.
This method has two parameters, the first parameter is the request url and the second parameter is the HTTP config object.
This method returns an observable container a HTTP response object.
Example of basic usage is shown below:
class SomeClass {
_http;
constructor() {
this._http = new RxJSHttpClient();
}
postRequest() {
const request = {
body: {
some: 'data'
}
}
this._http.post('some-url', request)
.pipe(
mergeMap((response) => response.json())
)
.subscribe((response) => {
console.log(response)
})
}
}
The put method provides you with the ability to make a HTTP PUT request.
This method has two parameters, the first parameter is the request url and the second parameter is the HTTP config object.
This method returns an observable container a HTTP response object.
Example of basic usage is shown below:
class SomeClass {
_http;
constructor() {
this._http = new RxJSHttpClient();
}
putRequest() {
const request = {
body: {
some: 'data'
}
}
this._http.put('some-url', request)
.pipe(
mergeMap((response) => response.json())
)
.subscribe((response) => {
console.log(response)
})
}
}
The patch method provides you with the ability to make a HTTP PATCH request.
This method has two parameters, the first parameter is the request url and the second parameter is the HTTP config object.
This method returns an observable container a HTTP response object.
Example of basic usage is shown below:
class SomeClass {
_http;
constructor() {
this._http = new RxJSHttpClient();
}
patchRequest() {
const request = {
body: {
some: 'data'
}
}
this._http.patch('some-url', request)
.pipe(
mergeMap((response) => response.json())
)
.subscribe((response) => {
console.log(response)
})
}
}
The delete method provides you with the ability to make a HTTP DELETE request.
This method has two parameters, the first parameter is the request url and the second parameter is the HTTP config object.
This method returns an observable container a HTTP response object.
Example of basic usage is shown below:
class SomeClass {
_http;
constructor() {
this._http = new RxJSHttpClient();
}
deleteRequest() {
const request = {
body: {
some: 'data'
}
}
this._http.delete('some-url', request)
.pipe(
mergeMap((response) => response.json())
)
.subscribe((response) => {
console.log(response)
})
}
}
The HTTP Config Object is a interface that is used as the second parameter to all the methods and is only optional on the get method. The Http Config Object contains the following properties that are all optional:
The HTTP Response Object is a interface that is returned from all of the HTTP client methods. The Http Response Object contains the following properties and methods:
It is possible to intercept a HTTP request by providing the HTTP client with an array of HTTP request interceptors. The request interceptors will run in the order they are provided in the array.
In order for a request interceptor to work correctly it must adhere to the following interface: IHttpInterceptor.
It is possible to intercept a HTTP response by providing the HTTP client with an array of HTTP response interceptors. The response interceptors will run in the order they are provided in the array.
In order for a response interceptor to work correctly it must adhere to the following interface: IHttpInterceptor.
The IHttpInterceptor interface is the interface which all HTTP interceptors must adhere to in order to work correctly. This interface consists of one method, the intercept method.
The intercept method has one parameter that is a HttpRequest if it is a request interceptor or a HttpResponse if it is a response interceptor.
The intercept method must return a HttpRequest if it is a request interceptor or a HttpResponse if it is a response interceptor.
An example of a http request interceptor is shown below:
class ExampleRequestInterceptor {
intercept(request) {
const newRequest = request.clone();
newRequest.headers = {
...request.headers,
testing: 'example adding a header to the request',
};
return newRequest;
}
}
An example of a http response interceptor is shown below:
class ExampleResponseInterceptor {
intercept(response) {
const newResponse = response.clone();
newResponse.status = 404;
return newResponse;
}
}
The first optional parameter of the RxjsHttpClient is an array of request interceptors and the second optional parameter is an array of response interceptors.
An example of a http client with just request interceptors is shown below:
class SomeClass {
_http;
constructor() {
this._http = new RxJSHttpClient([
new ExampleRequestInterceptor()
]);
}
}
An example of a http client with request interceptors and response interceptors is shown below:
class SomeClass {
_http;
constructor() {
this._http = new RxJSHttpClient([
new ExampleRequestInterceptor()
],
[
new ExampleResponseInterceptor()
]);
}
}
An example of a http client with just response interceptors is shown below:
class SomeClass {
_http;
constructor() {
this._http = new RxJSHttpClient([],
[
new ExampleResponseInterceptor()
]);
}
}
After passing interceptors into an instance of an RxjsHttpClient it will be used on all requests from then on but only on that instance.
The HttpRequest class is the fully mapped request that is passed to request interceptors for modification if required. It contains the following properties that can all be changed:
I'd like to hear from anyone who finds any bugs/ feature request for this library, go to The issues page
FAQs
A simple to use http client built on ES6 fetch and RxJS
We found that rxjs-http-cl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.