{"id":17706,"library":"httpplease","title":"httpplease","description":"httpplease is a lightweight (under 2KB gzipped) HTTP request library designed for \"isomorphic\" JavaScript applications, enabling the same codebase to run in both Node.js and browser environments. It maintains a browser-driven focus, explicitly supporting older environments like IE9 for cross-domain requests via plugins. The library features a simple, yet powerful, plugin system for extending its core functionality, such as adding Promise support or handling specific browser limitations. The current stable version is 0.16.4. The package appears to be unmaintained as there haven't been new releases in a considerable time, and its GitHub repository doesn't show recent activity, suggesting a stalled development lifecycle.","status":"abandoned","version":"0.16.4","language":"javascript","source_language":"en","source_url":"git://github.com/matthewwithanm/httpplease.js","tags":["javascript","xhr","request","http","XMLHttpRequest","isomorphic"],"install":[{"cmd":"npm install httpplease","lang":"bash","label":"npm"},{"cmd":"yarn add httpplease","lang":"bash","label":"yarn"},{"cmd":"pnpm add httpplease","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The library primarily exports a default function. While modern bundlers might handle named imports for CJS modules, a default import is the conventional approach for consuming its main export in ESM.","wrong":"import { httpplease } from 'httpplease';","symbol":"httpplease","correct":"import httpplease from 'httpplease';"},{"note":"This is the standard CommonJS import pattern, explicitly supported for bundlers like Browserify and Webpack mentioned in the README.","symbol":"httpplease","correct":"const httpplease = require('httpplease');"},{"note":"The `get` method is a property of the main `httpplease` export, not a named export itself. Destructuring requires accessing the property after importing the main object.","wrong":"const { get } = require('httpplease'); get('http://example.com', ...);","symbol":"httpplease","correct":"httpplease.get('http://example.com', ...);"}],"quickstart":{"code":"const httpplease = require('httpplease');\n\nhttpplease.get('http://example.com', function (err, res) {\n    if (err) {\n        console.error('Request failed:', err.message);\n        return;\n    }\n    console.log('Request successful! Status:', res.status);\n    console.log('Response body (truncated):', res.body ? res.body.substring(0, 100) + '...' : '[empty]');\n    // Example: Using the defaults method to create a specialized instance\n    const secureHttp = httpplease.defaults({\n        url: 'https://api.example.com/v1',\n        headers: {'X-Auth-Token': process.env.API_KEY ?? ''},\n        errorOn404: false\n    });\n\n    secureHttp({ method: 'POST', body: JSON.stringify({ data: 'hello' }) }, function(err, res) {\n        if (err) {\n            console.error('Secure API request failed:', err.message);\n            return;\n        }\n        console.log('Secure API response status:', res.status);\n    });\n});","lang":"javascript","description":"Demonstrates a basic GET request using `httpplease.get` and shows how to create a custom instance with default options using `httpplease.defaults` for a more complex API interaction."},"warnings":[{"fix":"Consider migrating to a modern, actively maintained HTTP client library that provides better security, performance, and feature support for contemporary JavaScript environments.","message":"The library appears to be unmaintained and has not seen updates for a considerable period. This means it may not address modern web standards, security vulnerabilities, or common performance optimizations found in actively developed HTTP clients.","severity":"gotcha","affected_versions":"<=0.16.4"},{"fix":"For ESM projects, use `import httpplease from 'httpplease';` and ensure your build tools (e.g., Webpack, Rollup) are configured to handle CJS interoperability. In Node.js, if in an ESM context, consider `const httpplease = await import('httpplease');` or ensure your project's `package.json` `type` field is not set to `module` unless you explicitly configure CJS loading.","message":"httpplease is primarily designed with CommonJS (CJS) module semantics, as indicated by its `require()` examples. While bundlers can often bridge CJS into ESM environments, direct usage in pure ESM Node.js projects might require specific configuration or the use of dynamic `import()`.","severity":"gotcha","affected_versions":"<=0.16.4"},{"fix":"To treat 404 responses as successful non-error outcomes, set `errorOn404: false` in your request options: `httpplease.get({url: 'http://example.com/missing', errorOn404: false}, (err, res) => { /* handle 404 in res */ });`","message":"The library defaults `errorOn404` to `true`, meaning HTTP 404 (Not Found) responses will trigger the error callback/promise rejection by default. This might not be desired for all applications where 404s are expected control flow rather than errors.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"For modern browser development, ensure you understand its underlying implementation (likely `XMLHttpRequest`) and any limitations this might impose compared to `fetch` or other contemporary solutions. Consider polyfills or other libraries for newer features.","message":"The README mentions supporting 'old IE' (IE9) and implicitly, older browser capabilities. This focus might mean modern browser features (e.g., `fetch` API alternatives, advanced CORS headers, service worker integration) are not natively supported or optimized without additional plugins or manual intervention.","severity":"gotcha","affected_versions":"<=0.16.4"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Increase the `timeout` option in your request configuration or optimize the server response time. Example: `httpplease.get({url: 'http://example.com', timeout: 5000}, (err, res) => { if (err && err.name === 'Timeout') { console.error('Request timed out'); } });`","cause":"The HTTP request took longer than the configured `timeout` value.","error":"Timeout"},{"fix":"Ensure you are importing `httpplease` as a default export or requiring it as the main module. If using a `<script>` tag, ensure the global `httpplease` object is correctly loaded. Example: `import httpplease from 'httpplease'; httpplease({method: 'GET', url: '...'});` or `const httpplease = require('httpplease'); httpplease({method: 'GET', url: '...'});`","cause":"Attempting to call `httpplease()` directly when it was imported as a named export or when a bundler's CJS-ESM interop created an object.","error":"TypeError: httpplease is not a function"},{"fix":"Verify that the `httpplease` standalone build script is correctly included in your HTML before your application code, and that no other script is overwriting the global `httpplease` variable.","cause":"The `httpplease` variable is not accessible in the current scope, often when using a standalone build via a `<script>` tag and the script hasn't loaded or the variable name is incorrect.","error":"ReferenceError: httpplease is not defined"},{"fix":"If 404s are expected and should not be treated as errors, set `errorOn404: false` in your request options. This will make the 404 response appear in the success callback (`res`) instead of the error callback (`err`).","cause":"The requested resource was not found on the server, and `errorOn404` is set to `true` (which is the default behavior).","error":"HTTP 404 Not Found (error callback invoked)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}