Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
bivrost-axios-adapter
Advanced tools
Bivrost Adapter for axios function.
npm i --save axios bivrost-axios-adapter
With Bivrost:
import DataSource from 'bivrost/data/source';
import bivrostApi from 'bivrost/http/api';
import axiosAdapter from 'bivrost-axios-adapter';
const api = bivrostApi({
host: 'localhost',
adapter: axiosAdapter(),
});
class UsersDataSource extends DataSource {
static api = {
loadAll: api('GET /users'),
};
loadUsers(filters) {
return this.invoke('loadAll', filters);
}
}
Direct calls:
import axiosAdapter from 'bivrost-axios-adapter';
const api = axiosAdapter({});
const options = {
method: 'GET',
query: {
groupId: 10,
},
headers: {
'Content-Type': 'application/json',
},
};
api('/users', options)
.then(data => {
// ...
})
.catch(response => {
// ...
});
import axiosAdapter from 'bivrost-axios-adapter';
const api = axiosAdapter({
// default options for each request with created adapter
options: {
withCredentials: false,
xsrfCookieName: 'XSRF-TOKEN',
},
});
Available options:
params
More details - https://www.npmjs.com/package/axios#request-api
The main difference between axios-adapter interceptors and axios interceptorsis - is that interceptors could be specified for each adpater separately.
import axiosAdapter from 'bivrost-axios-adapter';
const api = axiosAdapter({
interceptors: {
request: request => {
// ...
},
response: response => {
// ...
},
error: response => {
// ...
},
},
});
Interceptor example:
import axiosAdapter from 'bivrost-axios-adapter';
const api = axiosAdapter({
interceptors: {
response: httpResponse => httpResponse.data,
error: httpErrorResponse => Promise.reject(httpErrorResponse),
},
});
Bivrost allows to organize a simple interface to asyncronous APIs.
FAQs
Bivrost adapter for axios
The npm package bivrost-axios-adapter receives a total of 21 weekly downloads. As such, bivrost-axios-adapter popularity was classified as not popular.
We found that bivrost-axios-adapter 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.