Socket
Book a DemoInstallSign in
Socket

axios-light-my-request-adapter

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-light-my-request-adapter

Axios adapter for Light my Request

0.4.0
latest
Source
npmnpm
Version published
Weekly downloads
40
-21.57%
Maintainers
1
Weekly downloads
 
Created
Source

axios Light my Request Adapter

CI Docs

This can be used to wire an Axios based client to a server during testing using Light my Request. Requires axios@^1.

Documentation

Getting Started

const axios = require("axios");
const {
  createLightMyRequestAdapter,
} = require("axios-light-my-request-adapter");

function dispatch(req, res) {
  res.writeHead(200, { "Content-Type": "application/json" });
  res.end(JSON.stringify({ data: "Hello World!" }));
}

const instance = axios.create({
  baseURL: "http://localhost/",
  adapter: createLightMyRequestAdapter(dispatch),
});

(async function () {
  const res = await instance.get("/");
  console.log(res);
})();

Or with Fastify:

const axios = require("axios");
const fastify = require("fastify");
const {
  createLightMyRequestAdapterFromFastify,
} = require("axios-light-my-request-adapter");

const app = fastify();
app.get("/", async () => {
  return { data: "Hello World!" };
});

const instance = axios.create({
  baseURL: "http://localhost/",
  adapter: createLightMyRequestAdapterFromFastify(app),
});

(async function () {
  const res = await instance.get("/");
  console.log(res);
})();

Caveats

License

MIT.

Some code was taken from axios, see NOTICE

Keywords

axios

FAQs

Package last updated on 05 Jun 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.