Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vespaiach/axios-fetch-adapter

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vespaiach/axios-fetch-adapter - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

0

index.d.ts
import { AxiosRequestConfig, AxiosPromise } from 'axios';
export default function fetchAdapter(config: AxiosRequestConfig): AxiosPromise;

8

index.js

@@ -5,3 +5,3 @@ import axios from 'axios';

import buildFullPath from 'axios/lib/core/buildFullPath';
import { isUndefined } from 'axios/lib/utils';
import { isUndefined, isStandardBrowserEnv, isFormData } from 'axios/lib/utils';

@@ -107,2 +107,8 @@ /**

options.body = config.data;
// In these cases the browser will automatically set the correct Content-Type,
// but only if that header hasn't been set yet. So that's why we're deleting it.
if (isFormData(options.body) && isStandardBrowserEnv()) {
headers.delete('Content-Type');
}
}

@@ -109,0 +115,0 @@ if (config.mode) {

2

package.json
{
"name": "@vespaiach/axios-fetch-adapter",
"version": "0.3.0",
"version": "0.3.1",
"description": "Fetch adapter for axios",

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

@@ -9,3 +9,3 @@ # Why

```
``` sh
npm install axios

@@ -19,3 +19,3 @@ npm install @vespaiach/axios-fetch-adapter

```
``` js
const instance = axios.create({

@@ -31,3 +31,3 @@ baseURL: 'https://some-domain.com/api/',

```
``` js
axios.request({

@@ -41,4 +41,16 @@ url: '/user',

3. Use with FormData
``` js
axios.request({
url: '/user',
method: 'post',
adapter: fetchAdapter
data: new FormData(formId)
...
})
```
# Note
- Since, this adapter relies on fetch API so it won't work in Node environment
- Since, this adapter relies on fetch API so it won't work in Node environment

@@ -17,1 +17,13 @@ import axios from 'axios';

};
formElem.onsubmit = async (e) => {
e.preventDefault();
let response = await axios.request({
url: 'https://httpbin.org/post',
method: 'post',
data: new FormData(formElem),
adapter: fetchAdapter,
});
console.log(response);
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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