New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

msw-connect-web

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msw-connect-web

Mock Service Worker utility for connect-web

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

msw-connect-web

Mock Service Worker utility for connect-web.

🚧 Streaming requests and responses are not currently supported.

🚧 And server-side mocking is currently not supported either. (Because MSW has no support for Node.js globalThis.fetch. mswjs/interceptors#283)

Usage

Install package.

npm i -D msw-connect-web msw

Define mocks.

handlers.ts

import { createMswConnectWeb } from 'msw-connect-web';
const connect = createMswConnectWeb({ baseUrl: 'https://...' });
export const handlers = [
  connect(YourService, 'methodName', async (req, res, ctx) => {
    // You can access the request message (with types) using the `message` method.
    const requestMessage = await req.message();
    return res(
      ctx.delay(1000),
      // You can define response with `message` method.
      ctx.message(new ResponseMessage({ ... })),
    );
  }),
];

Keywords

FAQs

Package last updated on 29 Jan 2023

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc