Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
axios-taro4-adapter
Advanced tools
适配taro4.0.4
基于 axios
支持自定义适配器,只需要针对不同环境下的http请求api进行适配进行替换,axios
可以使用在任意平台。
由于 axios
在其他项目中大量使用,本项目实现 Taro
框架下的适配器,可以在 Taroa
项目中完美使用原汁原味的 axios
,统一团队前端技术栈,统一http请求类库。
采用此方式对项目零侵入,开发者专注于 axios
的api即可。
有用点小星星支持~
npm i axios@0.27.2
npm i axios-taro-adapter
仅需2行代码,完美使用 axios
替换 Taro.request
// api.js
import axios from "axios";
import { TaroAdapter } from "axios-taro-adapter";
const API_URL = "https://api.xxxx.com/";
const instance = axios.create({
baseURL: API_URL,
timeout: 10000,
adapter: TaroAdapter, // add this line,添加这一行使用taroAdapter
});
export const postData = data => {
return instance.post("/api/test", data);
}
例如: 原汁原味的拦截器
// interceptors for request
instance.interceptors.request.use(
function (config) {
return config;
},
function (error) {
return Promise.reject(error);
}
);
// interceptors for response
instance.interceptors.response.use(
function (response) {
if (response.data.code !== 0) {
return Promise.reject(response.data);
} else {
return response.data;
}
},
function (error) {
return Promise.reject(error.message);
}
);
FAQs
axios adaptor for taro.request
The npm package axios-taro4-adapter receives a total of 2 weekly downloads. As such, axios-taro4-adapter popularity was classified as not popular.
We found that axios-taro4-adapter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.