{"_id":"@derhuerst/http-basic","_rev":"4221455","name":"@derhuerst/http-basic","description":"Very low level wrapper arround http.request/https.request","dist-tags":{"latest":"8.2.4"},"maintainers":[{"name":"derhuerst","email":"mail@jannisr.de"}],"time":{"modified":"2026-03-04T17:21:46.000Z","created":"2020-04-05T22:33:47.085Z","8.2.4":"2022-07-04T14:54:34.362Z","8.2.3":"2022-06-27T13:40:31.469Z","8.2.2":"2022-01-02T20:05:30.879Z","8.2.1":"2020-09-16T13:14:58.236Z","8.2.0":"2020-04-05T22:33:47.085Z"},"users":{},"author":{"name":"ForbesLindesay"},"repository":{"type":"git","url":"git+https://github.com/derhuerst/http-basic.git"},"versions":{"8.2.4":{"name":"@derhuerst/http-basic","version":"8.2.4","main":"lib/index.js","types":"lib/index.d.ts","description":"Very low level wrapper arround http.request/https.request","keywords":["http","https","request","fetch","gzip","deflate","redirect","cache","etag","cache-control"],"dependencies":{"caseless":"^0.12.0","concat-stream":"^2.0.0","http-response-object":"^3.0.1","parse-cache-control":"^1.0.1"},"devDependencies":{"@types/concat-stream":"^2.0.0","@types/node":"^18.0.1","flowgen2":"^2.2.1","rimraf":"^3.0.2","serve-static":"^1.11.1","typescript":"^4.5.4"},"scripts":{"prepublishOnly":"npm run build","build":"tsc && flowgen lib/**/*","pretest":"npm run build","test":"node test/index && node test/cache && node test/cache-invalidation && rimraf lib/cache"},"engines":{"node":">=6.0.0"},"repository":{"type":"git","url":"git+https://github.com/derhuerst/http-basic.git"},"author":{"name":"ForbesLindesay"},"license":"MIT","gitHead":"d6a3467f4d6d86c7f5eff8dd57eeff3622245ed1","bugs":{"url":"https://github.com/derhuerst/http-basic/issues"},"homepage":"https://github.com/derhuerst/http-basic#readme","_id":"@derhuerst/http-basic@8.2.4","_nodeVersion":"18.4.0","_npmVersion":"8.12.1","dist":{"shasum":"d021ebb8f65d54bea681ae6f4a8733ce89e7f59b","size":11355,"noattachment":false,"key":"/@derhuerst/http-basic/-/@derhuerst/http-basic-8.2.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/@derhuerst/http-basic/download/@derhuerst/http-basic-8.2.4.tgz"},"_npmUser":{"name":"derhuerst","email":"mail@jannisr.de"},"directories":{},"maintainers":[{"name":"derhuerst","email":"mail@jannisr.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/http-basic_8.2.4_1656946474168_0.5710901727380753"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-07-04T14:54:44.852Z","publish_time":1656946474362,"_cnpm_publish_time":1656946474362},"8.2.3":{"name":"@derhuerst/http-basic","version":"8.2.3","main":"lib/index.js","types":"lib/index.d.ts","description":"Very low level wrapper arround http.request/https.request","keywords":["http","https","request","fetch","gzip","deflate","redirect","cache","etag","cache-control"],"dependencies":{"caseless":"^0.12.0","concat-stream":"^1.6.2","http-response-object":"^3.0.1","parse-cache-control":"^1.0.1"},"devDependencies":{"@types/concat-stream":"^1.6.0","@types/node":"^17.0.6","flowgen2":"^2.2.1","rimraf":"^2.5.4","serve-static":"^1.11.1","typescript":"^4.5.4"},"scripts":{"prepublishOnly":"npm run build","build":"tsc && flowgen lib/**/*","pretest":"npm run build","test":"node test/index && node test/cache && node test/cache-invalidation && rimraf lib/cache"},"engines":{"node":">=6.0.0"},"repository":{"type":"git","url":"git+https://github.com/derhuerst/http-basic.git"},"author":{"name":"ForbesLindesay"},"license":"MIT","gitHead":"2efef654f79d84a1f594fcad67686d4df8d68e95","bugs":{"url":"https://github.com/derhuerst/http-basic/issues"},"homepage":"https://github.com/derhuerst/http-basic#readme","_id":"@derhuerst/http-basic@8.2.3","_nodeVersion":"18.4.0","_npmVersion":"8.12.1","dist":{"shasum":"fbefd3db2f8f03fe59c2c7307d53ef68b42134a4","size":11350,"noattachment":false,"key":"/@derhuerst/http-basic/-/@derhuerst/http-basic-8.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/@derhuerst/http-basic/download/@derhuerst/http-basic-8.2.3.tgz"},"_npmUser":{"name":"derhuerst","email":"mail@jannisr.de"},"directories":{},"maintainers":[{"name":"derhuerst","email":"mail@jannisr.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/http-basic_8.2.3_1656337231283_0.1321225311517149"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-06-27T14:07:41.549Z","publish_time":1656337231469,"_cnpm_publish_time":1656337231469},"8.2.2":{"name":"@derhuerst/http-basic","version":"8.2.2","main":"lib/index.js","types":"lib/index.d.ts","description":"Very low level wrapper arround http.request/https.request","keywords":["http","https","request","fetch","gzip","deflate","redirect","cache","etag","cache-control"],"dependencies":{"caseless":"^0.12.0","concat-stream":"^1.6.2","http-response-object":"^3.0.1","parse-cache-control":"^1.0.1"},"devDependencies":{"@types/concat-stream":"^1.6.0","@types/node":"^11.9.0","flowgen2":"^2.2.1","rimraf":"^2.5.4","serve-static":"^1.11.1","typescript":"^2.3.4"},"scripts":{"prepublishOnly":"npm run build","build":"tsc && flowgen lib/**/*","pretest":"npm run build","test":"node test/index && node test/cache && node test/cache-invalidation && rimraf lib/cache"},"engines":{"node":">=6.0.0"},"repository":{"type":"git","url":"git+https://github.com/derhuerst/http-basic.git"},"author":{"name":"ForbesLindesay"},"license":"MIT","gitHead":"a178e6a1b6c2d9f6b8c489fb08a5c0cc378bb970","bugs":{"url":"https://github.com/derhuerst/http-basic/issues"},"homepage":"https://github.com/derhuerst/http-basic#readme","_id":"@derhuerst/http-basic@8.2.2","_nodeVersion":"17.2.0","_npmVersion":"8.3.0","dist":{"shasum":"48c88e66c4d47db3b20dd906693f897b22444a27","size":11178,"noattachment":false,"key":"/@derhuerst/http-basic/-/@derhuerst/http-basic-8.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@derhuerst/http-basic/download/@derhuerst/http-basic-8.2.2.tgz"},"_npmUser":{"name":"derhuerst","email":"mail@jannisr.de"},"directories":{},"maintainers":[{"name":"derhuerst","email":"mail@jannisr.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/http-basic_8.2.2_1641153930709_0.6070066618499372"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-01-02T20:05:37.961Z","publish_time":1641153930879,"_cnpm_publish_time":1641153930879},"8.2.1":{"name":"@derhuerst/http-basic","version":"8.2.1","main":"lib/index.js","types":"lib/index.d.ts","description":"Very low level wrapper arround http.request/https.request","keywords":["http","https","request","fetch","gzip","deflate","redirect","cache","etag","cache-control"],"dependencies":{"caseless":"^0.12.0","concat-stream":"^1.6.2","http-response-object":"^3.0.1","parse-cache-control":"^1.0.1"},"devDependencies":{"@types/concat-stream":"^1.6.0","@types/node":"^11.9.0","flowgen2":"^2.2.1","rimraf":"^2.5.4","serve-static":"^1.11.1","typescript":"^2.3.4"},"scripts":{"build":"tsc && flowgen lib/**/*","pretest":"npm run build","test":"node test/index && node test/cache && node test/cache-invalidation && rimraf lib/cache"},"engines":{"node":">=6.0.0"},"repository":{"type":"git","url":"git+https://github.com/ForbesLindesay/http-basic.git"},"author":{"name":"ForbesLindesay"},"license":"MIT","gitHead":"646836d87592192c52df121c3a3c253e84171c0b","bugs":{"url":"https://github.com/ForbesLindesay/http-basic/issues"},"homepage":"https://github.com/ForbesLindesay/http-basic#readme","_id":"@derhuerst/http-basic@8.2.1","_nodeVersion":"14.9.0","_npmVersion":"6.14.7","dist":{"shasum":"11e3964cf1f2fb40806f9a0fff0c451bb7526093","size":9970,"noattachment":false,"key":"/@derhuerst/http-basic/-/@derhuerst/http-basic-8.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@derhuerst/http-basic/download/@derhuerst/http-basic-8.2.1.tgz"},"maintainers":[{"name":"derhuerst","email":"mail@jannisr.de"}],"_npmUser":{"name":"derhuerst","email":"mail@jannisr.de"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/http-basic_8.2.1_1600262098051_0.8818946103517626"},"_hasShrinkwrap":false,"publish_time":1600262098236,"_cnpm_publish_time":1600262098236,"_cnpmcore_publish_time":"2021-12-18T14:26:26.581Z"},"8.2.0":{"name":"@derhuerst/http-basic","version":"8.2.0","main":"lib/index.js","types":"lib/index.d.ts","description":"Very low level wrapper arround http.request/https.request","keywords":["http","https","request","fetch","gzip","deflate","redirect","cache","etag","cache-control"],"dependencies":{"caseless":"^0.12.0","concat-stream":"^1.6.2","http-response-object":"^3.0.1","parse-cache-control":"^1.0.1"},"devDependencies":{"@types/concat-stream":"^1.6.0","@types/node":"^11.9.0","flowgen2":"^2.2.1","rimraf":"^2.5.4","serve-static":"^1.11.1","typescript":"^2.3.4"},"scripts":{"prepublishOnly":"npm run build","build":"tsc && flowgen lib/**/*","pretest":"npm run build","test":"node test/index && node test/cache && node test/cache-invalidation && rimraf lib/cache"},"engines":{"node":">=6.0.0"},"repository":{"type":"git","url":"git+https://github.com/derhuerst/http-basic.git"},"author":{"name":"ForbesLindesay"},"license":"MIT","gitHead":"8dc3f53ef6a4815728ebbfc7e8559b5418725bad","bugs":{"url":"https://github.com/derhuerst/http-basic/issues"},"homepage":"https://github.com/derhuerst/http-basic#readme","_id":"@derhuerst/http-basic@8.2.0","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"shasum":"d009a4a6820dea756061d21842e79d1dbf9a1e11","size":12893,"noattachment":false,"key":"/@derhuerst/http-basic/-/@derhuerst/http-basic-8.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@derhuerst/http-basic/download/@derhuerst/http-basic-8.2.0.tgz"},"maintainers":[{"name":"derhuerst","email":"mail@jannisr.de"}],"_npmUser":{"name":"derhuerst","email":"mail@jannisr.de"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/http-basic_8.2.0_1586126026887_0.8278847292445912"},"_hasShrinkwrap":false,"publish_time":1586126027085,"_cnpm_publish_time":1586126027085,"_cnpmcore_publish_time":"2021-12-18T14:26:26.829Z"}},"readme":"# http-basic\n\n**This is a temporary fork of [`ForbesLindesay/http-basic`](https://github.com/ForbesLindesay/http-basic).**\n\n---\n\nSimple wrapper arround http.request/https.request\n\n[![Build Status](https://img.shields.io/travis/ForbesLindesay/http-basic/master.svg)](https://travis-ci.org/ForbesLindesay/http-basic)\n[![Dependency Status](https://img.shields.io/david/ForbesLindesay/http-basic.svg)](https://david-dm.org/ForbesLindesay/http-basic)\n[![NPM version](https://img.shields.io/npm/v/http-basic.svg)](https://www.npmjs.org/package/http-basic)\n\n## Installation\n\n    npm install http-basic\n\n## Usage\n\n```js\nvar request = require('http-basic');\n\nvar options = {followRedirects: true, gzip: true, cache: 'memory'};\n\nvar req = request('GET', 'http://example.com', options, function (err, res) {\n  if (err) throw err;\n  console.dir(res.statusCode);\n  res.body.resume();\n});\nreq.end();\n```\n\n**method:**\n\nThe http method (e.g. `GET`, `POST`, `PUT`, `DELETE` etc.)\n\n**url:**\n\nThe url as a string (e.g. `http://example.com`).  It must be fully qualified and either http or https.\n\n**options:**\n\n - `headers` - (default `{}`) http headers\n - `agent` - (default: `false`) controlls keep-alive (see http://nodejs.org/api/http.html#http_http_request_options_callback)\n - `duplex` - (default: `true` except for `GET`, `OPTIONS` and `HEAD` requests) allows you to explicitly set a body on a request that uses a method that normally would not have a body\n - `followRedirects` - (default: `false`) - if true, redirects are followed (note that this only affects the result in the callback)\n - `maxRedirects` - (default: `Infinity`) - limit the number of redirects allowed.\n - `allowRedirectHeaders` (default: `null`) - an array of headers allowed for redirects (none if `null`).\n - `gzip` (default: `false`) - automatically accept gzip and deflate encodings.  This is kept completely transparent to the user.\n - `cache` - (default: `null`) - `'memory'` or `'file'` to use the default built in caches or you can pass your own cache implementation.\n - `timeout` (default: `false`) - times out if no response is returned within the given number of milliseconds.\n - `socketTimeout` (default: `false`) - calls `req.setTimeout` internally which causes the request to timeout if no new data is seen for the given number of milliseconds.\n - `retry` (default: `false`) - retry GET requests.  Set this to `true` to retry when the request errors or returns a status code greater than or equal to 400 (can also be a function that takes `(err, req, attemptNo) => shouldRetry`)\n - `retryDelay` (default: `200`) - the delay between retries (can also be set to a function that takes `(err, res, attemptNo) => delay`)\n - `maxRetries` (default: `5`) - the number of times to retry before giving up.\n - `ignoreFailedInvalidation` (default: `false`) - whether the cache should swallow errors if there is a problem removing a cached response. Note that enabling this setting may result in incorrect, cached data being returned to the user.\n - `isMatch` - `(requestHeaders: Headers, cachedResponse: CachedResponse, defaultValue: boolean) => boolean` - override the default behaviour for testing whether a cached response matches a request.\n - `isExpired` - `(cachedResponse: CachedResponse, defaultValue: boolean) => boolean` - override the default behaviour for testing whether a cached response has expired\n - `canCache` - `(res: Response<NodeJS.ReadableStream>, defaultValue: boolean) => boolean` - override the default behaviour for testing whether a response can be cached\n\n**callback:**\n\nThe callback is called with `err` as the first argument and `res` as the second argument. `res` is an [http-response-object](https://github.com/ForbesLindesay/http-response-object).  It has the following properties:\n\n - `statusCode` - a number representing the HTTP Status Code\n - `headers` - an object representing the HTTP headers\n - `body` - a readable stream respresenting the request body.\n - `url` - the URL that was requested (in the case of redirects, this is the final url that was requested)\n\n**returns:**\n\nIf the method is `GET`, `DELETE` or `HEAD`, it returns `undefined`.\n\nOtherwise, it returns a writable stream for the body of the request.\n\n## Implementing a Cache\n\nA `Cache` is an object with three methods:\n\n - `getResponse(url, callback)` - retrieve a cached response object\n - `setResponse(url, response)` - cache a response object\n - `invalidateResponse(url, callback)` - remove a response which is no longer valid\n\nA cached response object is an object with the following properties:\n\n - `statusCode` - Number\n - `headers` - Object (key value pairs of strings)\n - `body` - Stream (a stream of binary data)\n - `requestHeaders` - Object (key value pairs of strings)\n - `requestTimestamp` - Number\n\n`getResponse` should call the callback with an optional error and either `null` or a cached response object, depending on whether the url can be found in the cache.  Only `GET`s are cached.\n\n`setResponse` should just swallow any errors it has (or resport them using `console.warn`).\n\n`invalidateResponse` should call the callback with an optional error if it is unable to invalidate a response.\n\nA cache may also define any of the methods from `lib/cache-utils.js` to override behaviour for what gets cached.  It is currently still only possible to cache \"get\" requests, although this could be changed.\n\n## License\n\n  MIT\n","_attachments":{},"homepage":"https://github.com/derhuerst/http-basic#readme","bugs":{"url":"https://github.com/derhuerst/http-basic/issues"},"license":"MIT"}