Skip to main content

Install the package

npm install wreq-js

Make your first request

For multi-step flows, prefer sessions after your first request. One-off fetch() calls use an isolated request context by default.
import { fetch } from 'wreq-js';

const response = await fetch('https://httpbin.org/get', {
  browser: 'chrome_142',
});

console.log(await response.json());

Use a session for multiple requests

Sessions keep a shared session context across requests:
import { createSession } from 'wreq-js';

const session = await createSession({ browser: 'chrome_142' });

// Login
await session.fetch('https://example.com/login', {
  method: 'POST',
  body: new URLSearchParams({ user: 'name', pass: 'secret' }),
});

// Access authenticated endpoint in the same session context
const account = await session.fetch('https://example.com/account');
console.log(await account.text());

// Clean up
await session.close();

Use a proxy

import { fetch } from 'wreq-js';

const response = await fetch('https://example.com', {
  browser: 'chrome_142',
  proxy: 'http://user:pass@proxy.example.com:8080',
});

What’s next?