
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
curl2axios is a lightweight Axios interceptor for generating cURL commands from Axios requests. It simplifies the process of converting your Axios requests into cURL commands for easier debugging and sharing.
Install the library using npm or yarn:
npm install curl2axios
OR
yarn add curl2axios
Basic Usage
import axios from 'axios';
import { curlInterceptor } from 'curl2axios';
axios.interceptors.request.use(curlInterceptor);
axios.get('https://api.com/item/1');
This will automatically generate a cURL command in the console based on the Axios request.
{
occurredAt: '2024-02-02T22:17:45.514Z',
curlCommand: "curl 'https://api.com/item/1' -X GET -H 'Accept: application/json, text/plain, */*' -H 'Content-Type: '"
}
Custom Callback You can also provide a custom callback function to handle the generated cURL command. This is useful if you want to do something specific with the command, such as logging it in a different way.
import axios from 'axios';
import { curlInterceptor } from 'curl2axios';
const myCallback = (curl: string) => console.log(curl);
axios.interceptors.request.use((req) => curlInterceptor(req, myCallback));
axios.get('https://api.com/item/1');
In this example, the custom callback function myCallback will be called with the generated cURL command.
For the given Axios request:
axios.get('https://api.com/item/1');
// curl 'https://api.com/item/1' -X GET -H 'Accept: application/json, text/plain, */*' -H 'Content-Type: '
import axios from 'axios';
import { bindCurl } from 'curl2axios';
const instance = bindCurl(axios.create({ baseURL: 'https://pokeapi.co/api/v2' }));
await instance.get('/berry-flavor/1');
console.log(instance.curl);
// > "curl '/berry-flavor/1' -X GET -H 'Accept: application/json, text/plain, */*' -H 'Content-Type: ' --url 'https://pokeapi.co/api/v2'"
axios2curl is licensed under the MIT License - see the LICENSE file for details.
[0.0.3] - 2024-05-14
FAQs
This lib provide a interceptor to generate a curl from axios request
The npm package curl2axios receives a total of 120 weekly downloads. As such, curl2axios popularity was classified as not popular.
We found that curl2axios 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.