Registry / devops / request-promise-modern

request-promise-modern

JSON →
library0.1.0jsnpmunverified

request-promise-modern is a promise-first migration helper for the deprecated request-promise package. Version 0.1.0 wraps the native fetch API (Node >=18) to provide familiar promise-returning HTTP request methods with support for resolveWithFullResponse behavior. It ships TypeScript types, has zero runtime dependencies, and is released sporadically on GitHub. Key differentiator: bridges the gap for codebases migrating from request-promise without switching to a new API paradigm, while being lightweight and modern.

npm install request-promise-modern
INSTALL
IMPORT
SIG · REQUEST-PROMISE-MO
R
request-promise-modern
devopsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import rp from 'request-promise-modern'
const rp = require('request-promise-modern')
ESM-only package; CommonJS require will fail in Node >=18. The default export is the requestPromise function.
requestPromise
import { requestPromise } from 'request-promise-modern'
Named export available as an alternative to default import. Both refer to the same function.
types
import type { RequestPromiseOptions } from 'request-promise-modern'
TypeScript types are exported for the options interface. Use import type for type-only usage.

Demonstrates basic GET request, JSON parsing, and full response capture using resolveWithFullResponse.

import rp from 'request-promise-modern'; async function getExample() { const body = await rp('https://jsonplaceholder.typicode.com/todos/1'); console.log('Response body:', body); const data = await rp.json('https://jsonplaceholder.typicode.com/todos/1'); console.log('Parsed JSON:', data); const response = await rp({ uri: 'https://jsonplaceholder.typicode.com/todos/1', resolveWithFullResponse: true, }); console.log('Full response status:', response.statusCode); console.log('Full response body:', response.body); } getExample().catch(console.error);
Debug
Known issues
breakingThis package requires Node.js version >=18 because it relies on the native fetch API.
fix
Upgrade Node.js to v18 or later.
affects: >=0.1.0
breakingThe package is ESM-only. CommonJS require() will throw a runtime error.
fix
Use import syntax or switch to dynamic import() if you must use CommonJS.
affects: >=0.1.0
deprecatedrequest-promise-modern is not affiliated with the original request-promise package and may not have feature parity. resolveWithFullResponse behavior is supported but other options may differ.
fix
Consult the compatibility guide or check the source for supported options.
affects: >=0.1.0
gotchaThe default export is a function with convenience methods .get(), .post(), .text(), .json() attached. These are not available if you use named import { requestPromise }.
fix
Use default import to access convenience methods.
affects: >=0.1.0
gotcharesolveWithFullResponse option returns an object with statusCode, body, headers, etc., but not the exact same structure as request-promise (e.g., statusCode vs status).
fix
Check the returned object shape and adjust your code accordingly.
affects: >=0.1.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Running an ESM-only package in a CommonJS project without enabling ESM.
fix
Add "type": "module" in package.json, or rename file to .mjs, or use dynamic import: const rp = await import('request-promise-modern');
TypeError: rp is not a function
Using named import { requestPromise } where default import has convenience methods.
fix
Use default import: import rp from 'request-promise-modern';
fetch is not defined
Node.js version <18 does not have native fetch.
fix
Upgrade Node.js to v18 or later, or use a polyfill like node-fetch.
response.body is undefined when using resolveWithFullResponse
In some cases, the full response object may not contain body if parsing fails or option is misused.
fix
Ensure you pass resolveWithFullResponse: true in options object and that the request succeeds. Inspect response object keys.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
request-promise-modern — npm install request-promise-modern · libregistry