New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

axios-observable

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-observable - npm Package Compare versions

Comparing version 1.0.7 to 1.1.0

dist/create-observable.d.ts

4

dist/axios-observable.interface.d.ts

@@ -1,4 +0,4 @@

import { AxiosResponse } from "axios";
import { Observable } from "rxjs/index";
import { AxiosResponse } from 'axios';
import { Observable } from 'rxjs';
export interface AxiosObservable<T> extends Observable<AxiosResponse<T>> {
}

@@ -1,6 +0,5 @@

import { AxiosInstance, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from "axios";
import { AxiosObservable } from "./axios-observable.interface";
import { AxiosInstance, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from 'axios';
import { AxiosObservable } from './axios-observable.interface';
declare class Axios {
private axiosInstance;
constructor(axiosInstance: AxiosInstance);
static defaults: AxiosRequestConfig;

@@ -11,2 +10,4 @@ static interceptors: {

};
constructor(axiosInstance: AxiosInstance);
readonly defaults: AxiosRequestConfig;
static request<T = any>(config: AxiosRequestConfig): AxiosObservable<T>;

@@ -27,5 +28,4 @@ static get<T = any>(url: string, config?: AxiosRequestConfig): AxiosObservable<T>;

delete<T = any>(url: string, config?: AxiosRequestConfig): AxiosObservable<T>;
readonly defaults: AxiosRequestConfig;
}
export default Axios;
export { Axios };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var axios_1 = require("axios");
var promise_to_observable_1 = require("./promise-to-observable");
var create_observable_1 = require("./create-observable");
var Axios = /** @class */ (function () {

@@ -9,22 +9,29 @@ function Axios(axiosInstance) {

}
Object.defineProperty(Axios.prototype, "defaults", {
get: function () {
return this.axiosInstance.defaults;
},
enumerable: true,
configurable: true
});
Axios.request = function (config) {
return promise_to_observable_1.promiseToObservable(axios_1.default.request(config));
return create_observable_1.createObservable(axios_1.default.request, config);
};
Axios.get = function (url, config) {
return promise_to_observable_1.promiseToObservable(axios_1.default.get(url, config));
return create_observable_1.createObservable(axios_1.default.get, url, config);
};
Axios.post = function (url, data, config) {
return promise_to_observable_1.promiseToObservable(axios_1.default.post(url, data, config));
return create_observable_1.createObservable(axios_1.default.post, url, data, config);
};
Axios.put = function (url, data, config) {
return promise_to_observable_1.promiseToObservable(axios_1.default.put(url, data, config));
return create_observable_1.createObservable(axios_1.default.put, url, data, config);
};
Axios.patch = function (url, data, config) {
return promise_to_observable_1.promiseToObservable(axios_1.default.patch(url, data, config));
return create_observable_1.createObservable(axios_1.default.patch, url, data, config);
};
Axios.delete = function (url, config) {
return promise_to_observable_1.promiseToObservable(axios_1.default.delete(url, config));
return create_observable_1.createObservable(axios_1.default.delete, url, config);
};
Axios.head = function (url, config) {
return promise_to_observable_1.promiseToObservable(axios_1.default.head(url, config));
return create_observable_1.createObservable(axios_1.default.head, url, config);
};

@@ -35,29 +42,22 @@ Axios.create = function (config) {

Axios.prototype.request = function (config) {
return promise_to_observable_1.promiseToObservable(this.axiosInstance.request(config));
return create_observable_1.createObservable(this.axiosInstance.request, config);
};
Axios.prototype.get = function (url, config) {
return promise_to_observable_1.promiseToObservable(this.axiosInstance.get(url, config));
return create_observable_1.createObservable(this.axiosInstance.get, url, config);
};
Axios.prototype.head = function (url, config) {
return promise_to_observable_1.promiseToObservable(this.axiosInstance.head(url, config));
return create_observable_1.createObservable(this.axiosInstance.head, url, config);
};
Axios.prototype.post = function (url, data, config) {
return promise_to_observable_1.promiseToObservable(this.axiosInstance.post(url, data, config));
return create_observable_1.createObservable(this.axiosInstance.post, url, data, config);
};
Axios.prototype.put = function (url, data, config) {
return promise_to_observable_1.promiseToObservable(this.axiosInstance.put(url, data, config));
return create_observable_1.createObservable(this.axiosInstance.put, url, data, config);
};
Axios.prototype.patch = function (url, data, config) {
return promise_to_observable_1.promiseToObservable(this.axiosInstance.patch(url, data, config));
return create_observable_1.createObservable(this.axiosInstance.patch, url, data, config);
};
Axios.prototype.delete = function (url, config) {
return promise_to_observable_1.promiseToObservable(this.axiosInstance.delete(url, config));
return create_observable_1.createObservable(this.axiosInstance.delete, url, config);
};
Object.defineProperty(Axios.prototype, "defaults", {
get: function () {
return this.axiosInstance.defaults;
},
enumerable: true,
configurable: true
});
Axios.defaults = axios_1.default.defaults;

@@ -64,0 +64,0 @@ Axios.interceptors = axios_1.default.interceptors;

{
"name": "axios-observable",
"version": "1.0.7",
"version": "1.1.0",
"description": "make axios return Observable as opposed to Promise",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

# axios-observable
##### Observable (as opposed to Promise) based HTTP client for the browser and node.js
Want to use axios in a rxjs (observable) way? there we go!
Want to use axios in a rxjs (observable) way? There we go!
This API of axios-observable is almost same as API of axios, providing with smooth transition. So the documentation mirrors the one of axios (A few exceptions will be cleared pointed out).
This API of axios-observable is almost same as API of axios, giving you smooth transition. So the documentation mirrors the one of axios (A few exceptions will be cleared pointed out).

@@ -14,3 +14,3 @@ ## Features

- Transform request and response data
- Cancel requests in a more elegant way
- (NEW in v1.1.0) Cancel requests through unsubscribe
- Automatic transforms for JSON data

@@ -33,4 +33,4 @@ - Client side support for protecting against [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)

```js
const Axios = require('axios-observable').Axios;
// or import Axios from 'axios-observable';
import Axios from 'axios-observable';
// or const Axios = require('axios-observable').Axios;

@@ -54,2 +54,3 @@ // Make a request for a user with a given ID

);
```

@@ -67,3 +68,2 @@ Performing a `POST` request

);
```

@@ -70,0 +70,0 @@

@@ -9,4 +9,4 @@ {

"strict": true,
"lib": ["es2015"]
"lib": ["es2015", "dom"]
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc