Compare commits
1 Commits
master
...
dependabot
Author | SHA1 | Date |
---|---|---|
dependabot[bot] | 84a9db495d | 2 years ago |
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@ |
||||
/node_modules |
@ -1,37 +1,89 @@ |
||||
from node:16-alpine |
||||
FROM phusion/baseimage:bionic-1.0.0 |
||||
|
||||
RUN apk update |
||||
CMD ["/sbin/my_init"] |
||||
|
||||
RUN apk add --no-cache \ |
||||
sudo \ |
||||
curl \ |
||||
build-base \ |
||||
g++ \ |
||||
libpng \ |
||||
libpng-dev \ |
||||
jpeg-dev \ |
||||
pango-dev \ |
||||
cairo-dev \ |
||||
giflib-dev \ |
||||
python3 |
||||
ENV JAVA_MAJOR_VERSION=11 |
||||
|
||||
RUN apk add --no-cache tini |
||||
RUN mkdir -p /src/app |
||||
RUN apt-get update \ |
||||
&& apt-get install -y --no-install-recommends tzdata curl ca-certificates fontconfig locales \ |
||||
&& echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \ |
||||
&& locale-gen en_US.UTF-8 \ |
||||
&& rm -rf /var/lib/apt/lists/* |
||||
|
||||
RUN apk add ffmpeg |
||||
ENV JAVA_VERSION jdk-11.0.8+10 |
||||
|
||||
RUN yarn global add nodemon |
||||
RUN set -eux; \ |
||||
ARCH="$(dpkg --print-architecture)"; \ |
||||
case "${ARCH}" in \ |
||||
aarch64|arm64) \ |
||||
ESUM='286c869dbaefda9b470ae71d1250fdecf9f06d8da97c0f7df9021d381d749106'; \ |
||||
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_aarch64_linux_hotspot_11.0.8_10.tar.gz'; \ |
||||
;; \ |
||||
armhf|armv7l) \ |
||||
ESUM='ffa627b2d0c6001448bb8f1f24f7c9921dad37e67637f6ed0a9a479e680a3393'; \ |
||||
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_arm_linux_hotspot_11.0.8_10.tar.gz'; \ |
||||
;; \ |
||||
ppc64el|ppc64le) \ |
||||
ESUM='89231e1667d7cc4202d1a401497bb287d4eb12281c90c17e2570211cc4e901a3'; \ |
||||
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_ppc64le_linux_hotspot_11.0.8_10.tar.gz'; \ |
||||
;; \ |
||||
s390x) \ |
||||
ESUM='dc0e715c17abcb12bedf77c638e58e67d828d3c4bf24a898f0d4b053caaeb25f'; \ |
||||
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_s390x_linux_hotspot_11.0.8_10.tar.gz'; \ |
||||
;; \ |
||||
amd64|x86_64) \ |
||||
ESUM='98615b1b369509965a612232622d39b5cefe117d6189179cbad4dcef2ee2f4e1'; \ |
||||
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_x64_linux_hotspot_11.0.8_10.tar.gz'; \ |
||||
;; \ |
||||
*) \ |
||||
echo "Unsupported arch: ${ARCH}"; \ |
||||
exit 1; \ |
||||
;; \ |
||||
esac; \ |
||||
curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \ |
||||
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \ |
||||
mkdir -p /opt/java/openjdk; \ |
||||
cd /opt/java/openjdk; \ |
||||
tar -xf /tmp/openjdk.tar.gz --strip-components=1; \ |
||||
rm -rf /tmp/openjdk.tar.gz; |
||||
|
||||
WORKDIR /src/app |
||||
ENV JAVA_HOME=/opt/java/openjdk \ |
||||
PATH="/opt/java/openjdk/bin:$PATH" |
||||
|
||||
RUN apt-get update && \ |
||||
apt-get install -y ffmpeg && \ |
||||
apt-get clean; |
||||
|
||||
COPY ./package.json ./package-lock.json /src/app/ |
||||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ |
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ |
||||
apt-get update && \ |
||||
apt-get install -y yarn; |
||||
|
||||
RUN npm install |
||||
|
||||
WORKDIR /src/app |
||||
|
||||
COPY . /src/app |
||||
|
||||
EXPOSE 3005 |
||||
RUN yarn global add nodemon |
||||
# update |
||||
RUN apt-get update |
||||
# install curl |
||||
RUN apt-get install -y curl |
||||
# get install script and pass it to execute: |
||||
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash |
||||
# and install node |
||||
RUN apt-get install -y nodejs |
||||
# confirm that it was successful |
||||
RUN node -v |
||||
# npm installs automatically |
||||
RUN npm -v |
||||
|
||||
ENTRYPOINT ["/sbin/tini", "--"] |
||||
ENV TINI_VERSION v0.19.0 |
||||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini |
||||
RUN chmod +x /tini |
||||
ENTRYPOINT ["/tini", "--"] |
||||
|
||||
CMD [ "nodemon", "app.js" ] |
||||
EXPOSE 3005 |
||||
|
||||
CMD [ "nodemon", "app.js" ] |
@ -1,89 +0,0 @@ |
||||
FROM phusion/baseimage:bionic-1.0.0 |
||||
|
||||
CMD ["/sbin/my_init"] |
||||
|
||||
ENV JAVA_MAJOR_VERSION=11 |
||||
|
||||
RUN mkdir -p /src/app |
||||
RUN apt-get update \ |
||||
&& apt-get install -y --no-install-recommends tzdata curl ca-certificates fontconfig locales \ |
||||
&& echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \ |
||||
&& locale-gen en_US.UTF-8 \ |
||||
&& rm -rf /var/lib/apt/lists/* |
||||
|
||||
ENV JAVA_VERSION jdk-11.0.8+10 |
||||
|
||||
RUN set -eux; \ |
||||
ARCH="$(dpkg --print-architecture)"; \ |
||||
case "${ARCH}" in \ |
||||
aarch64|arm64) \ |
||||
ESUM='286c869dbaefda9b470ae71d1250fdecf9f06d8da97c0f7df9021d381d749106'; \ |
||||
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_aarch64_linux_hotspot_11.0.8_10.tar.gz'; \ |
||||
;; \ |
||||
armhf|armv7l) \ |
||||
ESUM='ffa627b2d0c6001448bb8f1f24f7c9921dad37e67637f6ed0a9a479e680a3393'; \ |
||||
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_arm_linux_hotspot_11.0.8_10.tar.gz'; \ |
||||
;; \ |
||||
ppc64el|ppc64le) \ |
||||
ESUM='89231e1667d7cc4202d1a401497bb287d4eb12281c90c17e2570211cc4e901a3'; \ |
||||
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_ppc64le_linux_hotspot_11.0.8_10.tar.gz'; \ |
||||
;; \ |
||||
s390x) \ |
||||
ESUM='dc0e715c17abcb12bedf77c638e58e67d828d3c4bf24a898f0d4b053caaeb25f'; \ |
||||
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_s390x_linux_hotspot_11.0.8_10.tar.gz'; \ |
||||
;; \ |
||||
amd64|x86_64) \ |
||||
ESUM='98615b1b369509965a612232622d39b5cefe117d6189179cbad4dcef2ee2f4e1'; \ |
||||
BINARY_URL='https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jre_x64_linux_hotspot_11.0.8_10.tar.gz'; \ |
||||
;; \ |
||||
*) \ |
||||
echo "Unsupported arch: ${ARCH}"; \ |
||||
exit 1; \ |
||||
;; \ |
||||
esac; \ |
||||
curl -LfsSo /tmp/openjdk.tar.gz ${BINARY_URL}; \ |
||||
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \ |
||||
mkdir -p /opt/java/openjdk; \ |
||||
cd /opt/java/openjdk; \ |
||||
tar -xf /tmp/openjdk.tar.gz --strip-components=1; \ |
||||
rm -rf /tmp/openjdk.tar.gz; |
||||
|
||||
ENV JAVA_HOME=/opt/java/openjdk \ |
||||
PATH="/opt/java/openjdk/bin:$PATH" |
||||
|
||||
RUN apt-get update && \ |
||||
apt-get install -y ffmpeg && \ |
||||
apt-get clean; |
||||
|
||||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ |
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ |
||||
apt-get update && \ |
||||
apt-get install -y yarn; |
||||
|
||||
|
||||
WORKDIR /src/app |
||||
|
||||
COPY . /src/app |
||||
|
||||
RUN yarn global add nodemon |
||||
# update |
||||
RUN apt-get update |
||||
# install curl |
||||
RUN apt-get install -y curl |
||||
# get install script and pass it to execute: |
||||
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash |
||||
# and install node |
||||
RUN apt-get install -y nodejs |
||||
# confirm that it was successful |
||||
RUN node -v |
||||
# npm installs automatically |
||||
RUN npm -v |
||||
|
||||
ENV TINI_VERSION v0.19.0 |
||||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini |
||||
RUN chmod +x /tini |
||||
ENTRYPOINT ["/tini", "--"] |
||||
|
||||
EXPOSE 3005 |
||||
|
||||
CMD [ "nodemon", "app.js" ] |
Before Width: | Height: | Size: 690 KiB |
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,72 +0,0 @@ |
||||
# assert-options |
||||
|
||||
Smart `options` handling, with one line of code: |
||||
|
||||
* throw detailed error on invalid options |
||||
* set default values for missing options |
||||
|
||||
Strongly-typed, built with TypeScript 4.x `strict` mode, for JavaScript clients. |
||||
|
||||
[![Build Status](https://travis-ci.org/vitaly-t/assert-options.svg?branch=master)](https://travis-ci.org/vitaly-t/assert-options) |
||||
[![Coverage Status](https://coveralls.io/repos/vitaly-t/assert-options/badge.svg?branch=master)](https://coveralls.io/r/vitaly-t/assert-options?branch=master) |
||||
|
||||
## Rationale |
||||
|
||||
* Passing in invalid or misspelled option names is one of the most common errors in JavaScript. |
||||
* Assigning defaults is the most common operation for methods that take options. |
||||
|
||||
This module automates proper options handling - parsing and setting defaults where needed. |
||||
|
||||
Although this library is implemented in TypeScript, its objective is mainly to help JavaScript clients, |
||||
because TypeScript itself can handle invalid options and defaults natively. |
||||
|
||||
## Installation |
||||
|
||||
``` |
||||
$ npm i assert-options |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
```js |
||||
const { assertOptions } = require('assert-options'); |
||||
|
||||
function functionWithOptions(options) { |
||||
options = assertOptions(options, {first: 123, second: null}); |
||||
|
||||
// options is a safe object here, with all missing defaults set. |
||||
} |
||||
``` |
||||
|
||||
When default values are not needed, you can just use an array of strings: |
||||
|
||||
```js |
||||
function functionWithOptions(options) { |
||||
options = assertOptions(options, ['first', 'second']); |
||||
|
||||
// the result is exactly the same as using the following: |
||||
// options = assertOptions(options, {first: undefined, second: undefined}); |
||||
|
||||
// options is a safe object here, without defaults. |
||||
} |
||||
``` |
||||
|
||||
## API |
||||
|
||||
### `assertOptions(options, defaults) => {}` |
||||
|
||||
* When `options` is `null`/`undefined`, new `{}` is returned, applying `defaults` as specified. |
||||
|
||||
* When `options` contains an unknown property, [Error] `Option "name" is not recognized.` is thrown. |
||||
|
||||
* When a property in `options` is missing or `undefined`, its value is set from the `defaults`, |
||||
provided it is available and its value is not `undefined`. |
||||
|
||||
* When `options` is not `null`/`undefined`, it must be of type `object`, or else [TypeError] is thrown: |
||||
`Invalid "options" parameter: value`. |
||||
|
||||
* Parameter `defaults` is required, as a non-`null` object or an array of strings, or else [TypeError] |
||||
is thrown: `Invalid "defaults" parameter: value`. |
||||
|
||||
[Error]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error |
||||
[TypeError]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError |
@ -1,33 +0,0 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
function assertOptions(options, defaults) { |
||||
if (options !== null && options !== undefined && typeof options !== 'object') { |
||||
throw new TypeError('Invalid "options" parameter: ' + JSON.stringify(options)); |
||||
} |
||||
var isArray = Array.isArray(defaults); |
||||
if (!isArray && (!defaults || typeof defaults !== 'object')) { |
||||
throw new TypeError('Invalid "defaults" parameter: ' + JSON.stringify(defaults)); |
||||
} |
||||
if (options) { |
||||
for (var _i = 0, _a = Object.keys(options); _i < _a.length; _i++) { |
||||
var a = _a[_i]; |
||||
if ((isArray && defaults.indexOf(a) === -1) || (!isArray && !(a in defaults))) { |
||||
throw new Error('Option "' + a + '" is not recognized.'); |
||||
} |
||||
} |
||||
} |
||||
else { |
||||
options = {}; |
||||
} |
||||
if (!isArray) { |
||||
var defs = defaults; |
||||
for (var _b = 0, _c = Object.keys(defs); _b < _c.length; _b++) { |
||||
var d = _c[_b]; |
||||
if (options[d] === undefined && defs[d] !== undefined) { |
||||
options[d] = defs[d]; |
||||
} |
||||
} |
||||
} |
||||
return options; |
||||
} |
||||
exports.assertOptions = assertOptions; |
@ -1,4 +0,0 @@ |
||||
export declare type NamedValues = { |
||||
[name: string]: any; |
||||
}; |
||||
export declare function assertOptions(options: NamedValues | null | undefined, defaults: NamedValues | string[]): NamedValues; |
@ -1,34 +0,0 @@ |
||||
"use strict"; |
||||
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
exports.assertOptions = void 0; |
||||
function assertOptions(options, defaults) { |
||||
if (options !== null && options !== undefined && typeof options !== 'object') { |
||||
throw new TypeError('Invalid "options" parameter: ' + JSON.stringify(options)); |
||||
} |
||||
var isArray = Array.isArray(defaults); |
||||
if (!isArray && (!defaults || typeof defaults !== 'object')) { |
||||
throw new TypeError('Invalid "defaults" parameter: ' + JSON.stringify(defaults)); |
||||
} |
||||
if (options) { |
||||
for (var _i = 0, _a = Object.keys(options); _i < _a.length; _i++) { |
||||
var a = _a[_i]; |
||||
if ((isArray && defaults.indexOf(a) === -1) || (!isArray && !(a in defaults))) { |
||||
throw new Error('Option "' + a + '" is not recognized.'); |
||||
} |
||||
} |
||||
} |
||||
else { |
||||
options = {}; |
||||
} |
||||
if (!isArray) { |
||||
var defs = defaults; |
||||
for (var _b = 0, _c = Object.keys(defs); _b < _c.length; _b++) { |
||||
var d = _c[_b]; |
||||
if (options[d] === undefined && defs[d] !== undefined) { |
||||
options[d] = defs[d]; |
||||
} |
||||
} |
||||
} |
||||
return options; |
||||
} |
||||
exports.assertOptions = assertOptions; |
@ -1,76 +0,0 @@ |
||||
{ |
||||
"_from": "assert-options@0.7.0", |
||||
"_id": "assert-options@0.7.0", |
||||
"_inBundle": false, |
||||
"_integrity": "sha512-7q9uNH/Dh8gFgpIIb9ja8PJEWA5AQy3xnBC8jtKs8K/gNVCr1K6kIvlm59HUyYgvM7oEDoLzGgPcGd9FqhtXEQ==", |
||||
"_location": "/assert-options", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "version", |
||||
"registry": true, |
||||
"raw": "assert-options@0.7.0", |
||||
"name": "assert-options", |
||||
"escapedName": "assert-options", |
||||
"rawSpec": "0.7.0", |
||||
"saveSpec": null, |
||||
"fetchSpec": "0.7.0" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/pg-promise" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/assert-options/-/assert-options-0.7.0.tgz", |
||||
"_shasum": "82c27618d9c0baa5e9da8ef607ee261a44ed6e5e", |
||||
"_spec": "assert-options@0.7.0", |
||||
"_where": "/home/sigonasr2/divar/server/node_modules/pg-promise", |
||||
"author": { |
||||
"name": "Vitaly Tomilov", |
||||
"email": "vitaly.tomilov@gmail.com" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/vitaly-t/assert-options/issues", |
||||
"email": "vitaly.tomilov@gmail.com" |
||||
}, |
||||
"bundleDependencies": false, |
||||
"deprecated": false, |
||||
"description": "Generic options parameter handling.", |
||||
"devDependencies": { |
||||
"@types/chai": "4.2.14", |
||||
"@types/mocha": "8.2.0", |
||||
"@types/node": "14.14.14", |
||||
"chai": "4.2.0", |
||||
"coveralls": "3.1.0", |
||||
"mocha": "8.2.1", |
||||
"mocha-lcov-reporter": "1.3.0", |
||||
"nyc": "15.1.0", |
||||
"ts-node": "9.1.1", |
||||
"tslint": "6.1.3", |
||||
"typescript": "4.1.3" |
||||
}, |
||||
"engines": { |
||||
"node": ">=8.0.0" |
||||
}, |
||||
"files": [ |
||||
"dist/src", |
||||
"dist/index.js" |
||||
], |
||||
"homepage": "https://github.com/vitaly-t/assert-options", |
||||
"keywords": [ |
||||
"assert", |
||||
"options" |
||||
], |
||||
"license": "MIT", |
||||
"main": "dist/src/index.js", |
||||
"name": "assert-options", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/vitaly-t/assert-options.git" |
||||
}, |
||||
"scripts": { |
||||
"all": "tsc && npm test && npm run lint", |
||||
"lint": "tslint --fix ./src/**/*.ts ./test/**/*.ts", |
||||
"test": "nyc mocha -r ts-node/register test/**/*.spec.ts", |
||||
"travis": "nyc npm test && nyc report --reporter=text-lcov | coveralls" |
||||
}, |
||||
"types": "dist/src/index.d.ts", |
||||
"version": "0.7.0" |
||||
} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,11 +0,0 @@ |
||||
'use strict'; |
||||
|
||||
/** |
||||
* Determines whether the payload is an error thrown by Axios |
||||
* |
||||
* @param {*} payload The value to test |
||||
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false |
||||
*/ |
||||
module.exports = function isAxiosError(payload) { |
||||
return (typeof payload === 'object') && (payload.isAxiosError === true); |
||||
}; |
@ -1,18 +0,0 @@ |
||||
Copyright 2014–present Olivier Lalonde <olalonde@gmail.com>, James Talmage <james@talmage.io>, Ruben Verborgh |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of |
||||
this software and associated documentation files (the "Software"), to deal in |
||||
the Software without restriction, including without limitation the rights to |
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
||||
of the Software, and to permit persons to whom the Software is furnished to do |
||||
so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR |
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@ -1,148 +0,0 @@ |
||||
## Follow Redirects |
||||
|
||||
Drop-in replacement for Node's `http` and `https` modules that automatically follows redirects. |
||||
|
||||
[![npm version](https://img.shields.io/npm/v/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects) |
||||
[![Build Status](https://github.com/follow-redirects/follow-redirects/workflows/CI/badge.svg)](https://github.com/follow-redirects/follow-redirects/actions) |
||||
[![Coverage Status](https://coveralls.io/repos/follow-redirects/follow-redirects/badge.svg?branch=master)](https://coveralls.io/r/follow-redirects/follow-redirects?branch=master) |
||||
[![npm downloads](https://img.shields.io/npm/dm/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects) |
||||
[![Sponsor on GitHub](https://img.shields.io/static/v1?label=Sponsor&message=%F0%9F%92%96&logo=GitHub)](https://github.com/sponsors/RubenVerborgh) |
||||
|
||||
`follow-redirects` provides [request](https://nodejs.org/api/http.html#http_http_request_options_callback) and [get](https://nodejs.org/api/http.html#http_http_get_options_callback) |
||||
methods that behave identically to those found on the native [http](https://nodejs.org/api/http.html#http_http_request_options_callback) and [https](https://nodejs.org/api/https.html#https_https_request_options_callback) |
||||
modules, with the exception that they will seamlessly follow redirects. |
||||
|
||||
```javascript |
||||
const { http, https } = require('follow-redirects'); |
||||
|
||||
http.get('http://bit.ly/900913', response => { |
||||
response.on('data', chunk => { |
||||
console.log(chunk); |
||||
}); |
||||
}).on('error', err => { |
||||
console.error(err); |
||||
}); |
||||
``` |
||||
|
||||
You can inspect the final redirected URL through the `responseUrl` property on the `response`. |
||||
If no redirection happened, `responseUrl` is the original request URL. |
||||
|
||||
```javascript |
||||
const request = https.request({ |
||||
host: 'bitly.com', |
||||
path: '/UHfDGO', |
||||
}, response => { |
||||
console.log(response.responseUrl); |
||||
// 'http://duckduckgo.com/robots.txt' |
||||
}); |
||||
request.end(); |
||||
``` |
||||
|
||||
## Options |
||||
### Global options |
||||
Global options are set directly on the `follow-redirects` module: |
||||
|
||||
```javascript |
||||
const followRedirects = require('follow-redirects'); |
||||
followRedirects.maxRedirects = 10; |
||||
followRedirects.maxBodyLength = 20 * 1024 * 1024; // 20 MB |
||||
``` |
||||
|
||||
The following global options are supported: |
||||
|
||||
- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. |
||||
|
||||
- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. |
||||
|
||||
### Per-request options |
||||
Per-request options are set by passing an `options` object: |
||||
|
||||
```javascript |
||||
const url = require('url'); |
||||
const { http, https } = require('follow-redirects'); |
||||
|
||||
const options = url.parse('http://bit.ly/900913'); |
||||
options.maxRedirects = 10; |
||||
options.beforeRedirect = (options, { headers }) => { |
||||
// Use this to adjust the request options upon redirecting, |
||||
// to inspect the latest response headers, |
||||
// or to cancel the request by throwing an error |
||||
if (options.hostname === "example.com") { |
||||
options.auth = "user:password"; |
||||
} |
||||
}; |
||||
http.request(options); |
||||
``` |
||||
|
||||
In addition to the [standard HTTP](https://nodejs.org/api/http.html#http_http_request_options_callback) and [HTTPS options](https://nodejs.org/api/https.html#https_https_request_options_callback), |
||||
the following per-request options are supported: |
||||
- `followRedirects` (default: `true`) – whether redirects should be followed. |
||||
|
||||
- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. |
||||
|
||||
- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. |
||||
|
||||
- `beforeRedirect` (default: `undefined`) – optionally change the request `options` on redirects, or abort the request by throwing an error. |
||||
|
||||
- `agents` (default: `undefined`) – sets the `agent` option per protocol, since HTTP and HTTPS use different agents. Example value: `{ http: new http.Agent(), https: new https.Agent() }` |
||||
|
||||
- `trackRedirects` (default: `false`) – whether to store the redirected response details into the `redirects` array on the response object. |
||||
|
||||
|
||||
### Advanced usage |
||||
By default, `follow-redirects` will use the Node.js default implementations |
||||
of [`http`](https://nodejs.org/api/http.html) |
||||
and [`https`](https://nodejs.org/api/https.html). |
||||
To enable features such as caching and/or intermediate request tracking, |
||||
you might instead want to wrap `follow-redirects` around custom protocol implementations: |
||||
|
||||
```javascript |
||||
const { http, https } = require('follow-redirects').wrap({ |
||||
http: require('your-custom-http'), |
||||
https: require('your-custom-https'), |
||||
}); |
||||
``` |
||||
|
||||
Such custom protocols only need an implementation of the `request` method. |
||||
|
||||
## Browser Usage |
||||
|
||||
Due to the way the browser works, |
||||
the `http` and `https` browser equivalents perform redirects by default. |
||||
|
||||
By requiring `follow-redirects` this way: |
||||
```javascript |
||||
const http = require('follow-redirects/http'); |
||||
const https = require('follow-redirects/https'); |
||||
``` |
||||
you can easily tell webpack and friends to replace |
||||
`follow-redirect` by the built-in versions: |
||||
|
||||
```json |
||||
{ |
||||
"follow-redirects/http" : "http", |
||||
"follow-redirects/https" : "https" |
||||
} |
||||
``` |
||||
|
||||
## Contributing |
||||
|
||||
Pull Requests are always welcome. Please [file an issue](https://github.com/follow-redirects/follow-redirects/issues) |
||||
detailing your proposal before you invest your valuable time. Additional features and bug fixes should be accompanied |
||||
by tests. You can run the test suite locally with a simple `npm test` command. |
||||
|
||||
## Debug Logging |
||||
|
||||
`follow-redirects` uses the excellent [debug](https://www.npmjs.com/package/debug) for logging. To turn on logging |
||||
set the environment variable `DEBUG=follow-redirects` for debug output from just this module. When running the test |
||||
suite it is sometimes advantageous to set `DEBUG=*` to see output from the express server as well. |
||||
|
||||
## Authors |
||||
|
||||
- [Ruben Verborgh](https://ruben.verborgh.org/) |
||||
- [Olivier Lalonde](mailto:olalonde@gmail.com) |
||||
- [James Talmage](mailto:james@talmage.io) |
||||
|
||||
## License |
||||
|
||||
[MIT License](https://github.com/follow-redirects/follow-redirects/blob/master/LICENSE) |
@ -1,14 +0,0 @@ |
||||
var debug; |
||||
|
||||
module.exports = function () { |
||||
if (!debug) { |
||||
try { |
||||
/* eslint global-require: off */ |
||||
debug = require("debug")("follow-redirects"); |
||||
} |
||||
catch (error) { |
||||
debug = function () { /* */ }; |
||||
} |
||||
} |
||||
debug.apply(null, arguments); |
||||
}; |
@ -1 +0,0 @@ |
||||
module.exports = require("./").http; |
@ -1 +0,0 @@ |
||||
module.exports = require("./").https; |
@ -1,504 +0,0 @@ |
||||
var url = require("url"); |
||||
var URL = url.URL; |
||||
var http = require("http"); |
||||
var https = require("https"); |
||||
var Writable = require("stream").Writable; |
||||
var assert = require("assert"); |
||||
var debug = require("./debug"); |
||||
|
||||
// Create handlers that pass events from native requests
|
||||
var eventHandlers = Object.create(null); |
||||
["abort", "aborted", "connect", "error", "socket", "timeout"].forEach(function (event) { |
||||
eventHandlers[event] = function (arg1, arg2, arg3) { |
||||
this._redirectable.emit(event, arg1, arg2, arg3); |
||||
}; |
||||
}); |
||||
|
||||
// Error types with codes
|
||||
var RedirectionError = createErrorType( |
||||
"ERR_FR_REDIRECTION_FAILURE", |
||||
"" |
||||
); |
||||
var TooManyRedirectsError = createErrorType( |
||||
"ERR_FR_TOO_MANY_REDIRECTS", |
||||
"Maximum number of redirects exceeded" |
||||
); |
||||
var MaxBodyLengthExceededError = createErrorType( |
||||
"ERR_FR_MAX_BODY_LENGTH_EXCEEDED", |
||||
"Request body larger than maxBodyLength limit" |
||||
); |
||||
var WriteAfterEndError = createErrorType( |
||||
"ERR_STREAM_WRITE_AFTER_END", |
||||
"write after end" |
||||
); |
||||
|
||||
// An HTTP(S) request that can be redirected
|
||||
function RedirectableRequest(options, responseCallback) { |
||||
// Initialize the request
|
||||
Writable.call(this); |
||||
this._sanitizeOptions(options); |
||||
this._options = options; |
||||
this._ended = false; |
||||
this._ending = false; |
||||
this._redirectCount = 0; |
||||
this._redirects = []; |
||||
this._requestBodyLength = 0; |
||||
this._requestBodyBuffers = []; |
||||
|
||||
// Attach a callback if passed
|
||||
if (responseCallback) { |
||||
this.on("response", responseCallback); |
||||
} |
||||
|
||||
// React to responses of native requests
|
||||
var self = this; |
||||
this._onNativeResponse = function (response) { |
||||
self._processResponse(response); |
||||
}; |
||||
|
||||
// Perform the first request
|
||||
this._performRequest(); |
||||
} |
||||
RedirectableRequest.prototype = Object.create(Writable.prototype); |
||||
|
||||
// Writes buffered data to the current native request
|
||||
RedirectableRequest.prototype.write = function (data, encoding, callback) { |
||||
// Writing is not allowed if end has been called
|
||||
if (this._ending) { |
||||
throw new WriteAfterEndError(); |
||||
} |
||||
|
||||
// Validate input and shift parameters if necessary
|
||||
if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) { |
||||
throw new TypeError("data should be a string, Buffer or Uint8Array"); |
||||
} |
||||
if (typeof encoding === "function") { |
||||
callback = encoding; |
||||
encoding = null; |
||||
} |
||||
|
||||
// Ignore empty buffers, since writing them doesn't invoke the callback
|
||||
// https://github.com/nodejs/node/issues/22066
|
||||
if (data.length === 0) { |
||||
if (callback) { |
||||
callback(); |
||||
} |
||||
return; |
||||
} |
||||
// Only write when we don't exceed the maximum body length
|
||||
if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { |
||||
this._requestBodyLength += data.length; |
||||
this._requestBodyBuffers.push({ data: data, encoding: encoding }); |
||||
this._currentRequest.write(data, encoding, callback); |
||||
} |
||||
// Error when we exceed the maximum body length
|
||||
else { |
||||
this.emit("error", new MaxBodyLengthExceededError()); |
||||
this.abort(); |
||||
} |
||||
}; |
||||
|
||||
// Ends the current native request
|
||||
RedirectableRequest.prototype.end = function (data, encoding, callback) { |
||||
// Shift parameters if necessary
|
||||
if (typeof data === "function") { |
||||
callback = data; |
||||
data = encoding = null; |
||||
} |
||||
else if (typeof encoding === "function") { |
||||
callback = encoding; |
||||
encoding = null; |
||||
} |
||||
|
||||
// Write data if needed and end
|
||||
if (!data) { |
||||
this._ended = this._ending = true; |
||||
this._currentRequest.end(null, null, callback); |
||||
} |
||||
else { |
||||
var self = this; |
||||
var currentRequest = this._currentRequest; |
||||
this.write(data, encoding, function () { |
||||
self._ended = true; |
||||
currentRequest.end(null, null, callback); |
||||
}); |
||||
this._ending = true; |
||||
} |
||||
}; |
||||
|
||||
// Sets a header value on the current native request
|
||||
RedirectableRequest.prototype.setHeader = function (name, value) { |
||||
this._options.headers[name] = value; |
||||
this._currentRequest.setHeader(name, value); |
||||
}; |
||||
|
||||
// Clears a header value on the current native request
|
||||
RedirectableRequest.prototype.removeHeader = function (name) { |
||||
delete this._options.headers[name]; |
||||
this._currentRequest.removeHeader(name); |
||||
}; |
||||
|
||||
// Global timeout for all underlying requests
|
||||
RedirectableRequest.prototype.setTimeout = function (msecs, callback) { |
||||
if (callback) { |
||||
this.once("timeout", callback); |
||||
} |
||||
|
||||
if (this.socket) { |
||||
startTimer(this, msecs); |
||||
} |
||||
else { |
||||
var self = this; |
||||
this._currentRequest.once("socket", function () { |
||||
startTimer(self, msecs); |
||||
}); |
||||
} |
||||
|
||||
this.once("response", clearTimer); |
||||
this.once("error", clearTimer); |
||||
|
||||
return this; |
||||
}; |
||||
|
||||
function startTimer(request, msecs) { |
||||
clearTimeout(request._timeout); |
||||
request._timeout = setTimeout(function () { |
||||
request.emit("timeout"); |
||||
}, msecs); |
||||
} |
||||
|
||||
function clearTimer() { |
||||
clearTimeout(this._timeout); |
||||
} |
||||
|
||||
// Proxy all other public ClientRequest methods
|
||||
[ |
||||
"abort", "flushHeaders", "getHeader", |
||||
"setNoDelay", "setSocketKeepAlive", |
||||
].forEach(function (method) { |
||||
RedirectableRequest.prototype[method] = function (a, b) { |
||||
return this._currentRequest[method](a, b); |
||||
}; |
||||
}); |
||||
|
||||
// Proxy all public ClientRequest properties
|
||||
["aborted", "connection", "socket"].forEach(function (property) { |
||||
Object.defineProperty(RedirectableRequest.prototype, property, { |
||||
get: function () { return this._currentRequest[property]; }, |
||||
}); |
||||
}); |
||||
|
||||
RedirectableRequest.prototype._sanitizeOptions = function (options) { |
||||
// Ensure headers are always present
|
||||
if (!options.headers) { |
||||
options.headers = {}; |
||||
} |
||||
|
||||
// Since http.request treats host as an alias of hostname,
|
||||
// but the url module interprets host as hostname plus port,
|
||||
// eliminate the host property to avoid confusion.
|
||||
if (options.host) { |
||||
// Use hostname if set, because it has precedence
|
||||
if (!options.hostname) { |
||||
options.hostname = options.host; |
||||
} |
||||
delete options.host; |
||||
} |
||||
|
||||
// Complete the URL object when necessary
|
||||
if (!options.pathname && options.path) { |
||||
var searchPos = options.path.indexOf("?"); |
||||
if (searchPos < 0) { |
||||
options.pathname = options.path; |
||||
} |
||||
else { |
||||
options.pathname = options.path.substring(0, searchPos); |
||||
options.search = options.path.substring(searchPos); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
|
||||
// Executes the next native request (initial or redirect)
|
||||
RedirectableRequest.prototype._performRequest = function () { |
||||
// Load the native protocol
|
||||
var protocol = this._options.protocol; |
||||
var nativeProtocol = this._options.nativeProtocols[protocol]; |
||||
if (!nativeProtocol) { |
||||
this.emit("error", new TypeError("Unsupported protocol " + protocol)); |
||||
return; |
||||
} |
||||
|
||||
// If specified, use the agent corresponding to the protocol
|
||||
// (HTTP and HTTPS use different types of agents)
|
||||
if (this._options.agents) { |
||||
var scheme = protocol.substr(0, protocol.length - 1); |
||||
this._options.agent = this._options.agents[scheme]; |
||||
} |
||||
|
||||
// Create the native request
|
||||
var request = this._currentRequest = |
||||
nativeProtocol.request(this._options, this._onNativeResponse); |
||||
this._currentUrl = url.format(this._options); |
||||
|
||||
// Set up event handlers
|
||||
request._redirectable = this; |
||||
for (var event in eventHandlers) { |
||||
/* istanbul ignore else */ |
||||
if (event) { |
||||
request.on(event, eventHandlers[event]); |
||||
} |
||||
} |
||||
|
||||
// End a redirected request
|
||||
// (The first request must be ended explicitly with RedirectableRequest#end)
|
||||
if (this._isRedirect) { |
||||
// Write the request entity and end.
|
||||
var i = 0; |
||||
var self = this; |
||||
var buffers = this._requestBodyBuffers; |
||||
(function writeNext(error) { |
||||
// Only write if this request has not been redirected yet
|
||||
/* istanbul ignore else */ |
||||
if (request === self._currentRequest) { |
||||
// Report any write errors
|
||||
/* istanbul ignore if */ |
||||
if (error) { |
||||
self.emit("error", error); |
||||
} |
||||
// Write the next buffer if there are still left
|
||||
else if (i < buffers.length) { |
||||
var buffer = buffers[i++]; |
||||
/* istanbul ignore else */ |
||||
if (!request.finished) { |
||||
request.write(buffer.data, buffer.encoding, writeNext); |
||||
} |
||||
} |
||||
// End the request if `end` has been called on us
|
||||
else if (self._ended) { |
||||
request.end(); |
||||
} |
||||
} |
||||
}()); |
||||
} |
||||
}; |
||||
|
||||
// Processes a response from the current native request
|
||||
RedirectableRequest.prototype._processResponse = function (response) { |
||||
// Store the redirected response
|
||||
var statusCode = response.statusCode; |
||||
if (this._options.trackRedirects) { |
||||
this._redirects.push({ |
||||
url: this._currentUrl, |
||||
headers: response.headers, |
||||
statusCode: statusCode, |
||||
}); |
||||
} |
||||
|
||||
// RFC7231§6.4: The 3xx (Redirection) class of status code indicates
|
||||
// that further action needs to be taken by the user agent in order to
|
||||
// fulfill the request. If a Location header field is provided,
|
||||
// the user agent MAY automatically redirect its request to the URI
|
||||
// referenced by the Location field value,
|
||||
// even if the specific status code is not understood.
|
||||
var location = response.headers.location; |
||||
if (location && this._options.followRedirects !== false && |
||||
statusCode >= 300 && statusCode < 400) { |
||||
// Abort the current request
|
||||
this._currentRequest.removeAllListeners(); |
||||
this._currentRequest.on("error", noop); |
||||
this._currentRequest.abort(); |
||||
// Discard the remainder of the response to avoid waiting for data
|
||||
response.destroy(); |
||||
|
||||
// RFC7231§6.4: A client SHOULD detect and intervene
|
||||
// in cyclical redirections (i.e., "infinite" redirection loops).
|
||||
if (++this._redirectCount > this._options.maxRedirects) { |
||||
this.emit("error", new TooManyRedirectsError()); |
||||
return; |
||||
} |
||||
|
||||
// RFC7231§6.4: Automatic redirection needs to done with
|
||||
// care for methods not known to be safe, […]
|
||||
// RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
|
||||
// the request method from POST to GET for the subsequent request.
|
||||
if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || |
||||
// RFC7231§6.4.4: The 303 (See Other) status code indicates that
|
||||
// the server is redirecting the user agent to a different resource […]
|
||||
// A user agent can perform a retrieval request targeting that URI
|
||||
// (a GET or HEAD request if using HTTP) […]
|
||||
(statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) { |
||||
this._options.method = "GET"; |
||||
// Drop a possible entity and headers related to it
|
||||
this._requestBodyBuffers = []; |
||||
removeMatchingHeaders(/^content-/i, this._options.headers); |
||||
} |
||||
|
||||
// Drop the Host header, as the redirect might lead to a different host
|
||||
var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) || |
||||
url.parse(this._currentUrl).hostname; |
||||
|
||||
// Create the redirected request
|
||||
var redirectUrl = url.resolve(this._currentUrl, location); |
||||
debug("redirecting to", redirectUrl); |
||||
this._isRedirect = true; |
||||
var redirectUrlParts = url.parse(redirectUrl); |
||||
Object.assign(this._options, redirectUrlParts); |
||||
|
||||
// Drop the Authorization header if redirecting to another host
|
||||
if (redirectUrlParts.hostname !== previousHostName) { |
||||
removeMatchingHeaders(/^authorization$/i, this._options.headers); |
||||
} |
||||
|
||||
// Evaluate the beforeRedirect callback
|
||||
if (typeof this._options.beforeRedirect === "function") { |
||||
var responseDetails = { headers: response.headers }; |
||||
try { |
||||
this._options.beforeRedirect.call(null, this._options, responseDetails); |
||||
} |
||||
catch (err) { |
||||
this.emit("error", err); |
||||
return; |
||||
} |
||||
this._sanitizeOptions(this._options); |
||||
} |
||||
|
||||
// Perform the redirected request
|
||||
try { |
||||
this._performRequest(); |
||||
} |
||||
catch (cause) { |
||||
var error = new RedirectionError("Redirected request failed: " + cause.message); |
||||
error.cause = cause; |
||||
this.emit("error", error); |
||||
} |
||||
} |
||||
else { |
||||
// The response is not a redirect; return it as-is
|
||||
response.responseUrl = this._currentUrl; |
||||
response.redirects = this._redirects; |
||||
this.emit("response", response); |
||||
|
||||
// Clean up
|
||||
this._requestBodyBuffers = []; |
||||
} |
||||
}; |
||||
|
||||
// Wraps the key/value object of protocols with redirect functionality
|
||||
function wrap(protocols) { |
||||
// Default settings
|
||||
var exports = { |
||||
maxRedirects: 21, |
||||
maxBodyLength: 10 * 1024 * 1024, |
||||
}; |
||||
|
||||
// Wrap each protocol
|
||||
var nativeProtocols = {}; |
||||
Object.keys(protocols).forEach(function (scheme) { |
||||
var protocol = scheme + ":"; |
||||
var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; |
||||
var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); |
||||
|
||||
// Executes a request, following redirects
|
||||
function request(input, options, callback) { |
||||
// Parse parameters
|
||||
if (typeof input === "string") { |
||||
var urlStr = input; |
||||
try { |
||||
input = urlToOptions(new URL(urlStr)); |
||||
} |
||||
catch (err) { |
||||
/* istanbul ignore next */ |
||||
input = url.parse(urlStr); |
||||
} |
||||
} |
||||
else if (URL && (input instanceof URL)) { |
||||
input = urlToOptions(input); |
||||
} |
||||
else { |
||||
callback = options; |
||||
options = input; |
||||
input = { protocol: protocol }; |
||||
} |
||||
if (typeof options === "function") { |
||||
callback = options; |
||||
options = null; |
||||
} |
||||
|
||||
// Set defaults
|
||||
options = Object.assign({ |
||||
maxRedirects: exports.maxRedirects, |
||||
maxBodyLength: exports.maxBodyLength, |
||||
}, input, options); |
||||
options.nativeProtocols = nativeProtocols; |
||||
|
||||
assert.equal(options.protocol, protocol, "protocol mismatch"); |
||||
debug("options", options); |
||||
return new RedirectableRequest(options, callback); |
||||
} |
||||
|
||||
// Executes a GET request, following redirects
|
||||
function get(input, options, callback) { |
||||
var wrappedRequest = wrappedProtocol.request(input, options, callback); |
||||
wrappedRequest.end(); |
||||
return wrappedRequest; |
||||
} |
||||
|
||||
// Expose the properties on the wrapped protocol
|
||||
Object.defineProperties(wrappedProtocol, { |
||||
request: { value: request, configurable: true, enumerable: true, writable: true }, |
||||
get: { value: get, configurable: true, enumerable: true, writable: true }, |
||||
}); |
||||
}); |
||||
return exports; |
||||
} |
||||
|
||||
/* istanbul ignore next */ |
||||
function noop() { /* empty */ } |
||||
|
||||
// from https://github.com/nodejs/node/blob/master/lib/internal/url.js
|
||||
function urlToOptions(urlObject) { |
||||
var options = { |
||||
protocol: urlObject.protocol, |
||||
hostname: urlObject.hostname.startsWith("[") ? |
||||
/* istanbul ignore next */ |
||||
urlObject.hostname.slice(1, -1) : |
||||
urlObject.hostname, |
||||
hash: urlObject.hash, |
||||
search: urlObject.search, |
||||
pathname: urlObject.pathname, |
||||
path: urlObject.pathname + urlObject.search, |
||||
href: urlObject.href, |
||||
}; |
||||
if (urlObject.port !== "") { |
||||
options.port = Number(urlObject.port); |
||||
} |
||||
return options; |
||||
} |
||||
|
||||
function removeMatchingHeaders(regex, headers) { |
||||
var lastValue; |
||||
for (var header in headers) { |
||||
if (regex.test(header)) { |
||||
lastValue = headers[header]; |
||||
delete headers[header]; |
||||
} |
||||
} |
||||
return lastValue; |
||||
} |
||||
|
||||
function createErrorType(code, defaultMessage) { |
||||
function CustomError(message) { |
||||
Error.captureStackTrace(this, this.constructor); |
||||
this.message = message || defaultMessage; |
||||
} |
||||
CustomError.prototype = new Error(); |
||||
CustomError.prototype.constructor = CustomError; |
||||
CustomError.prototype.name = "Error [" + code + "]"; |
||||
CustomError.prototype.code = code; |
||||
return CustomError; |
||||
} |
||||
|
||||
// Exports
|
||||
module.exports = wrap({ http: http, https: https }); |
||||
module.exports.wrap = wrap; |
@ -1,98 +0,0 @@ |
||||
{ |
||||
"_args": [ |
||||
[ |
||||
"follow-redirects@1.13.2", |
||||
"/home/sigonasr2/divar/server" |
||||
] |
||||
], |
||||
"_from": "follow-redirects@1.13.2", |
||||
"_id": "follow-redirects@1.13.2", |
||||
"_inBundle": false, |
||||
"_integrity": "sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA==", |
||||
"_location": "/axios/follow-redirects", |
||||
"_phantomChildren": {}, |
||||
"_requested": { |
||||
"type": "version", |
||||
"registry": true, |
||||
"raw": "follow-redirects@1.13.2", |
||||
"name": "follow-redirects", |
||||
"escapedName": "follow-redirects", |
||||
"rawSpec": "1.13.2", |
||||
"saveSpec": null, |
||||
"fetchSpec": "1.13.2" |
||||
}, |
||||
"_requiredBy": [ |
||||
"/axios" |
||||
], |
||||
"_resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.2.tgz", |
||||
"_spec": "1.13.2", |
||||
"_where": "/home/sigonasr2/divar/server", |
||||
"author": { |
||||
"name": "Ruben Verborgh", |
||||
"email": "ruben@verborgh.org", |
||||
"url": "https://ruben.verborgh.org/" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/follow-redirects/follow-redirects/issues" |
||||
}, |
||||
"contributors": [ |
||||
{ |
||||
"name": "Olivier Lalonde", |
||||
"email": "olalonde@gmail.com", |
||||
"url": "http://www.syskall.com" |
||||
}, |
||||
{ |
||||
"name": "James Talmage", |
||||
"email": "james@talmage.io" |
||||
} |
||||
], |
||||
"description": "HTTP and HTTPS modules that follow redirects.", |
||||
"devDependencies": { |
||||
"concat-stream": "^2.0.0", |
||||
"eslint": "^5.16.0", |
||||
"express": "^4.16.4", |
||||
"lolex": "^3.1.0", |
||||
"mocha": "^6.0.2", |
||||
"nyc": "^14.1.1" |
||||
}, |
||||
"engines": { |
||||
"node": ">=4.0" |
||||
}, |
||||
"files": [ |
||||
"*.js" |
||||
], |
||||
"funding": [ |
||||
{ |
||||
"type": "individual", |
||||
"url": "https://github.com/sponsors/RubenVerborgh" |
||||
} |
||||
], |
||||
"homepage": "https://github.com/follow-redirects/follow-redirects", |
||||
"keywords": [ |
||||
"http", |
||||
"https", |
||||
"url", |
||||
"redirect", |
||||
"client", |
||||
"location", |
||||
"utility" |
||||
], |
||||
"license": "MIT", |
||||
"main": "index.js", |
||||
"name": "follow-redirects", |
||||
"peerDependenciesMeta": { |
||||
"debug": { |
||||
"optional": true |
||||
} |
||||
}, |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+ssh://git@github.com/follow-redirects/follow-redirects.git" |
||||
}, |
||||
"scripts": { |
||||
"lint": "eslint *.js test", |
||||
"mocha": "nyc mocha", |
||||
"test": "npm run lint && npm run mocha" |
||||
}, |
||||
"version": "1.13.2" |
||||
} |
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue