{"id":16533,"library":"sl-request","title":"sl-request: Simplified HTTP Client (Fork of Deprecated 'request')","description":"sl-request is a Node.js HTTP client, version 1.0.8, explicitly stated as a fork of the widely used but now deprecated `request` library, primarily for internal use by sealights.io. This package attempts to provide a simplified API for making HTTP calls, supporting HTTPS, automatic redirects, streaming, and various request body types (forms, multipart). However, inheriting its core from the original `request` library, it carries the same limitations and risks, including a callback-centric API, known security vulnerabilities, and a lack of modern maintenance. The original `request` library was officially deprecated in February 2020 due to its unmaintained status, security risks, and outdated architectural patterns that do not align with modern JavaScript and Node.js paradigms. Users should be aware that `sl-request` likely shares these fundamental issues and does not offer a current, actively maintained solution for HTTP requests. Release cadence is infrequent, reflecting its internal-use nature and the deprecated status of its upstream.","status":"deprecated","version":"1.0.8","language":"javascript","source_language":"en","source_url":"https://github.com/Sealights/request","tags":["javascript","http","simple","util","utility","typescript"],"install":[{"cmd":"npm install sl-request","lang":"bash","label":"npm"},{"cmd":"yarn add sl-request","lang":"bash","label":"yarn"},{"cmd":"pnpm add sl-request","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"While `request` was the original package name, this fork is named `sl-request`. This is the primary ESM import pattern. CommonJS `require` is also supported.","wrong":"const request = require('request');","symbol":"request","correct":"import request from 'sl-request';"},{"note":"This is the CommonJS import pattern, as shown in the package's README, adjusted for the `sl-request` package name. The underlying `request` library was primarily CJS-focused.","wrong":"import request from 'sl-request';","symbol":"request (CommonJS)","correct":"const request = require('sl-request');"},{"note":"The `request` library (and thus this fork) exports a main function, with convenience methods like `get` and `post` attached as properties to that function, not as named exports directly from the module.","wrong":"import { get } from 'sl-request';","symbol":"request.get, request.post","correct":"import request from 'sl-request';\nrequest.get('...');"}],"quickstart":{"code":"import request from 'sl-request';\nimport fs from 'fs';\n\n// Basic GET request\nrequest('http://www.google.com', function (error, response, body) {\n  if (error) {\n    console.error('Error:', error);\n    return;\n  }\n  console.log('statusCode:', response && response.statusCode);\n  console.log('Body snippet:', body.substring(0, 100) + '...');\n});\n\n// Stream a file to a PUT request\n// For demonstration, create a dummy file first\nfs.writeFileSync('temp_upload.json', JSON.stringify({ message: 'Hello from sl-request' }));\n\nfs.createReadStream('temp_upload.json')\n  .pipe(request.put('http://httpbin.org/put', function (error, response, body) {\n    if (error) {\n      console.error('PUT Error:', error);\n      return;\n    }\n    console.log('PUT statusCode:', response && response.statusCode);\n    console.log('PUT Response:', body);\n    fs.unlinkSync('temp_upload.json'); // Clean up dummy file\n  }));\n\n// Example of error handling for streaming\nrequest.get('http://nonexistent-domain.invalid/image.png')\n  .on('error', function(err) {\n    console.error('Streaming error caught:', err.message);\n  })\n  .pipe(fs.createWriteStream('downloaded_image.png'));","lang":"typescript","description":"Demonstrates basic GET request, streaming a file via PUT, and error handling for stream-based operations, using `sl-request`."},"warnings":[{"fix":"Migrate to a modern, actively maintained HTTP client like `axios`, `node-fetch`, or `got`. Review your project's dependency tree for `request` or its forks and plan for replacement.","message":"The `sl-request` package is a direct fork of the original `request` library, which has been officially deprecated since February 2020 and is no longer maintained. This means `sl-request` inherently carries all the maintenance, security, and architectural issues of the unmaintained `request` library.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Immediately replace `sl-request` with a secure, well-maintained HTTP client. Regularly audit your dependencies using `npm audit` and keep them updated.","message":"Due to its unmaintained nature, `sl-request` (and `request`) is susceptible to unpatched security vulnerabilities. Continuing to use it can expose your application to critical security risks, including supply chain attacks, data breaches, or denial-of-service vulnerabilities.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"If migrating is not immediately possible, use `util.promisify` from Node.js's built-in `util` module to wrap callback-style functions, or consider a dedicated promise-wrapper library if available for this fork. The better long-term solution is migration.","message":"The API is primarily callback-based, which can lead to 'callback hell' in complex asynchronous flows. While some promise-based wrappers existed for the original `request`, `sl-request` does not natively provide modern `async/await` support without manual promisification.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Monitor memory usage and performance closely in production. The most effective fix is to migrate to a modern HTTP client designed with better performance and memory management.","message":"The original `request` library (and thus its forks) was known for potential memory leaks and performance inefficiencies, especially with high concurrency or large data streams, due to its older codebase and lack of modern optimizations.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Ensure you are importing the correct package name: `const request = require('sl-request');` or `import request from 'sl-request';`.","cause":"Attempting to `require('request')` or `import 'request'` instead of `sl-request` when the package installed is `sl-request`.","error":"Error: Cannot find module 'request'"},{"fix":"Acknowledge that `sl-request` inherits the deprecation status of its upstream. While the warning is expected, the recommended fix is to migrate to a modern, actively maintained HTTP client.","cause":"This warning directly indicates that the underlying `request` library, which `sl-request` is forked from, is deprecated. This warning will appear even for `sl-request` installations due to its origin.","error":"DeprecationWarning: request has been deprecated, see https://github.com/request/request/issues/3142"},{"fix":"Use the correct import pattern: for ESM `import request from 'sl-request';` or for CJS `const request = require('sl-request');`. The main export is a callable function, not an object with named properties that need destructuring.","cause":"This usually happens when `request` is imported incorrectly, such as `import { request } from 'sl-request';` instead of a default import, or if the `require` statement doesn't correctly assign the function.","error":"TypeError: request is not a function"}],"ecosystem":"npm"}