Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@txdfe/at-exceed
Advanced tools
用法
import Exceed from '@alife/at-exceed';
const apimap = [
{
id: 'memberSearch',
url: '/api/members/search',
method: 'get',
timeout: 2000, // 设置接口超时时间
},
];
// 对apimap做一次封装,最简只需定义id和url字段
function apimapCreator(apimapArr) {
// 在这里可以对请求做一些统一处理,如加前缀、加headers
return apimapArr.map(option => Object.assign(option, {
name: option.name || option.id,
id: option.id,
method: option.method || 'get',
contentType: option.type || 'application/x-www-form-urlencoded',
urls: {
local: `${window.UILessConfig.host}${option.url}`,
},
timeout: option.timeout || 3000, // 设置接口超时时间
}));
}
const exceed = new Exceed({
ENV: 'local',
timeout: 3000, // 设置默认超时时间
});
exceed.use(apimapCreator(apimap));
exceed.interceptors.request.use((config) => {
if (config && config.headers) {
config.headers['x-requested-with'] = 'XMLHttpRequest';
config.headers['Authorization'] = `Bearer ${window.UILessConfig.accessToken}`;
config.headers['X-Tenant-Id'] = `${window.UILessConfig.orgId}`;
config.headers['X-app-id'] = `${window.UILessConfig.appId}`;
}
return config;
}, (error) => {
return Promise.reject(error);
});
exceed.interceptors.response.use(
(response) => {
response.status = parseInt(response.headers['x-http-status'] || response.status);
const code = parseInt(response.data.code);
if (code > 300 || code < 200) {
return Promise.reject(response);
}
return Promise.resolve(response);
},
(error) => {
return Promise.reject(error);
},
);
export default exceed;
import exceed from 'utils/api';
exceed.fetch({
api: 'memberSearch',
data: {
q,
}
}).then(res => {
console.log(res)
})
注意
如果method
为post
且contentType
为'application/x-www-form-urlencoded'
,可通过qsOtions
设置stringify参数的选项.
const apimap = [
{
id: 'memberSearch',
url: '/api/members/search',
method: 'post',
contentType: 'application/x-www-form-urlencoded',
qsOptions: {
allowDots: true,
},
},
];
FAQs
axios
We found that @txdfe/at-exceed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.