Update node_modules

This commit is contained in:
crazy-max 2020-04-03 09:14:39 +00:00
parent 9eb3529e22
commit df18511cc6
12 changed files with 202 additions and 65 deletions

15
node_modules/qs/.github/workflows/rebase.yml generated vendored Normal file
View File

@ -0,0 +1,15 @@
name: Automatic Rebase
on: [pull_request]
jobs:
_:
name: "Automatic Rebase"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: ljharb/rebase@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

54
node_modules/qs/CHANGELOG.md generated vendored
View File

@ -1,3 +1,16 @@
## **6.9.3**
- [Fix] proper comma parsing of URL-encoded commas (#361)
- [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336)
## **6.9.2**
- [Fix] `parse`: Fix parsing array from object with `comma` true (#359)
- [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349)
- [meta] ignore eclint transitive audit warning
- [meta] fix indentation in package.json
- [meta] add tidelift marketing copy
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-inspect`, `has-symbols`, `tape`, `mkdirp`, `iconv-lite`
- [actions] add automatic rebasing / merge commit blocking
## **6.9.1** ## **6.9.1**
- [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335) - [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335)
- [Fix] `parse`: with comma true, do not split non-string values (#334) - [Fix] `parse`: with comma true, do not split non-string values (#334)
@ -13,6 +26,23 @@
- [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16` - [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16`
- [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray - [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray
## **6.8.2**
- [Fix] proper comma parsing of URL-encoded commas (#361)
- [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336)
## **6.8.1**
- [Fix] `parse`: Fix parsing array from object with `comma` true (#359)
- [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349)
- [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335)
- [fix] `parse`: with comma true, do not split non-string values (#334)
- [meta] add tidelift marketing copy
- [meta] add `funding` field
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `evalmd`, `has-symbols`, `iconv-lite`, `mkdirp`, `object-inspect`
- [Tests] `parse`: add passing `arrayFormat` tests
- [Tests] use shared travis-ci configs
- [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray
- [actions] add automatic rebasing / merge commit blocking
## **6.8.0** ## **6.8.0**
- [New] add `depth=false` to preserve the original key; [Fix] `depth=0` should preserve the original key (#326) - [New] add `depth=false` to preserve the original key; [Fix] `depth=0` should preserve the original key (#326)
- [New] [Fix] stringify symbols and bigints - [New] [Fix] stringify symbols and bigints
@ -27,6 +57,30 @@
- [meta] add FUNDING.yml - [meta] add FUNDING.yml
- [meta] Clean up license text so its properly detected as BSD-3-Clause - [meta] Clean up license text so its properly detected as BSD-3-Clause
## **6.7.2**
- [Fix] proper comma parsing of URL-encoded commas (#361)
- [Fix] parses comma delimited array while having percent-encoded comma treated as normal text (#336)
## **6.7.1**
- [Fix] `parse`: Fix parsing array from object with `comma` true (#359)
- [Fix] `parse`: with comma true, handle field that holds an array of arrays (#335)
- [fix] `parse`: with comma true, do not split non-string values (#334)
- [Fix] `parse`: throw a TypeError instead of an Error for bad charset (#349)
- [Fix] fix for an impossible situation: when the formatter is called with a non-string value
- [Refactor] `formats`: tiny bit of cleanup.
- readme: add security note
- [meta] add tidelift marketing copy
- [meta] add `funding` field
- [meta] add FUNDING.yml
- [meta] Clean up license text so its properly detected as BSD-3-Clause
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `safe-publish-latest`, `evalmd`, `iconv-lite`, `mkdirp`, `object-inspect`, `browserify`
- [Tests] `parse`: add passing `arrayFormat` tests
- [Tests] use shared travis-ci configs
- [Tests] `Buffer.from` in node v5.0-v5.9 and v4.0-v4.4 requires a TypedArray
- [Tests] add tests for `depth=0` and `depth=false` behavior, both current and intuitive/intended
- [Tests] use `eclint` instead of `editorconfig-tools`
- [actions] add automatic rebasing / merge commit blocking
## **6.7.0** ## **6.7.0**
- [New] `stringify`/`parse`: add `comma` as an `arrayFormat` option (#276, #219) - [New] `stringify`/`parse`: add `comma` as an `arrayFormat` option (#276, #219)
- [Fix] correctly parse nested arrays (#212) - [Fix] correctly parse nested arrays (#212)

6
node_modules/qs/README.md generated vendored
View File

@ -581,6 +581,12 @@ assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC1738' }), 'a=b+c');
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
## qs for enterprise
Available as part of the Tidelift Subscription
The maintainers of qs and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-qs?utm_source=npm-qs&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
[1]: https://npmjs.org/package/qs [1]: https://npmjs.org/package/qs
[2]: http://versionbadg.es/ljharb/qs.svg [2]: http://versionbadg.es/ljharb/qs.svg
[3]: https://api.travis-ci.org/ljharb/qs.svg [3]: https://api.travis-ci.org/ljharb/qs.svg

44
node_modules/qs/dist/qs.js generated vendored
View File

@ -71,6 +71,25 @@ var interpretNumericEntities = function (str) {
}); });
}; };
var parseArrayValue = function (val, options) {
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
return val.split(',');
}
return val;
};
var maybeMap = function maybeMap(val, fn) {
if (isArray(val)) {
var mapped = [];
for (var i = 0; i < val.length; i += 1) {
mapped.push(fn(val[i]));
}
return mapped;
}
return fn(val);
};
// This is what browsers will submit when the ✓ character occurs in an // This is what browsers will submit when the ✓ character occurs in an
// application/x-www-form-urlencoded body and the encoding of the page containing // application/x-www-form-urlencoded body and the encoding of the page containing
// the form is iso-8859-1, or when the submitted form has an accept-charset // the form is iso-8859-1, or when the submitted form has an accept-charset
@ -119,17 +138,18 @@ var parseValues = function parseQueryStringValues(str, options) {
val = options.strictNullHandling ? null : ''; val = options.strictNullHandling ? null : '';
} else { } else {
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key'); key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
val = options.decoder(part.slice(pos + 1), defaults.decoder, charset, 'value'); val = maybeMap(
parseArrayValue(part.slice(pos + 1), options),
function (encodedVal) {
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
}
);
} }
if (val && options.interpretNumericEntities && charset === 'iso-8859-1') { if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
val = interpretNumericEntities(val); val = interpretNumericEntities(val);
} }
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
val = val.split(',');
}
if (part.indexOf('[]=') > -1) { if (part.indexOf('[]=') > -1) {
val = isArray(val) ? [val] : val; val = isArray(val) ? [val] : val;
} }
@ -144,8 +164,8 @@ var parseValues = function parseQueryStringValues(str, options) {
return obj; return obj;
}; };
var parseObject = function (chain, val, options) { var parseObject = function (chain, val, options, valuesParsed) {
var leaf = val; var leaf = valuesParsed ? val : parseArrayValue(val, options);
for (var i = chain.length - 1; i >= 0; --i) { for (var i = chain.length - 1; i >= 0; --i) {
var obj; var obj;
@ -173,13 +193,13 @@ var parseObject = function (chain, val, options) {
} }
} }
leaf = obj; leaf = obj; // eslint-disable-line no-param-reassign
} }
return leaf; return leaf;
}; };
var parseKeys = function parseQueryStringKeys(givenKey, val, options) { var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
if (!givenKey) { if (!givenKey) {
return; return;
} }
@ -230,7 +250,7 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
keys.push('[' + key.slice(segment.index) + ']'); keys.push('[' + key.slice(segment.index) + ']');
} }
return parseObject(keys, val, options); return parseObject(keys, val, options, valuesParsed);
}; };
var normalizeParseOptions = function normalizeParseOptions(opts) { var normalizeParseOptions = function normalizeParseOptions(opts) {
@ -243,7 +263,7 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
} }
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
throw new Error('The charset option must be either utf-8, iso-8859-1, or undefined'); throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
} }
var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset; var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
@ -282,7 +302,7 @@ module.exports = function (str, opts) {
var keys = Object.keys(tempObj); var keys = Object.keys(tempObj);
for (var i = 0; i < keys.length; ++i) { for (var i = 0; i < keys.length; ++i) {
var key = keys[i]; var key = keys[i];
var newObj = parseKeys(key, tempObj[key], options); var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
obj = utils.merge(obj, newObj, options); obj = utils.merge(obj, newObj, options);
} }

44
node_modules/qs/lib/parse.js generated vendored
View File

@ -29,6 +29,25 @@ var interpretNumericEntities = function (str) {
}); });
}; };
var parseArrayValue = function (val, options) {
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
return val.split(',');
}
return val;
};
var maybeMap = function maybeMap(val, fn) {
if (isArray(val)) {
var mapped = [];
for (var i = 0; i < val.length; i += 1) {
mapped.push(fn(val[i]));
}
return mapped;
}
return fn(val);
};
// This is what browsers will submit when the ✓ character occurs in an // This is what browsers will submit when the ✓ character occurs in an
// application/x-www-form-urlencoded body and the encoding of the page containing // application/x-www-form-urlencoded body and the encoding of the page containing
// the form is iso-8859-1, or when the submitted form has an accept-charset // the form is iso-8859-1, or when the submitted form has an accept-charset
@ -77,17 +96,18 @@ var parseValues = function parseQueryStringValues(str, options) {
val = options.strictNullHandling ? null : ''; val = options.strictNullHandling ? null : '';
} else { } else {
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key'); key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
val = options.decoder(part.slice(pos + 1), defaults.decoder, charset, 'value'); val = maybeMap(
parseArrayValue(part.slice(pos + 1), options),
function (encodedVal) {
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
}
);
} }
if (val && options.interpretNumericEntities && charset === 'iso-8859-1') { if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
val = interpretNumericEntities(val); val = interpretNumericEntities(val);
} }
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
val = val.split(',');
}
if (part.indexOf('[]=') > -1) { if (part.indexOf('[]=') > -1) {
val = isArray(val) ? [val] : val; val = isArray(val) ? [val] : val;
} }
@ -102,8 +122,8 @@ var parseValues = function parseQueryStringValues(str, options) {
return obj; return obj;
}; };
var parseObject = function (chain, val, options) { var parseObject = function (chain, val, options, valuesParsed) {
var leaf = val; var leaf = valuesParsed ? val : parseArrayValue(val, options);
for (var i = chain.length - 1; i >= 0; --i) { for (var i = chain.length - 1; i >= 0; --i) {
var obj; var obj;
@ -131,13 +151,13 @@ var parseObject = function (chain, val, options) {
} }
} }
leaf = obj; leaf = obj; // eslint-disable-line no-param-reassign
} }
return leaf; return leaf;
}; };
var parseKeys = function parseQueryStringKeys(givenKey, val, options) { var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
if (!givenKey) { if (!givenKey) {
return; return;
} }
@ -188,7 +208,7 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
keys.push('[' + key.slice(segment.index) + ']'); keys.push('[' + key.slice(segment.index) + ']');
} }
return parseObject(keys, val, options); return parseObject(keys, val, options, valuesParsed);
}; };
var normalizeParseOptions = function normalizeParseOptions(opts) { var normalizeParseOptions = function normalizeParseOptions(opts) {
@ -201,7 +221,7 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
} }
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
throw new Error('The charset option must be either utf-8, iso-8859-1, or undefined'); throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
} }
var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset; var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
@ -240,7 +260,7 @@ module.exports = function (str, opts) {
var keys = Object.keys(tempObj); var keys = Object.keys(tempObj);
for (var i = 0; i < keys.length; ++i) { for (var i = 0; i < keys.length; ++i) {
var key = keys[i]; var key = keys[i];
var newObj = parseKeys(key, tempObj[key], options); var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
obj = utils.merge(obj, newObj, options); obj = utils.merge(obj, newObj, options);
} }

44
node_modules/qs/package.json generated vendored
View File

@ -1,31 +1,31 @@
{ {
"_args": [ "_args": [
[ [
"qs@6.9.1", "qs@6.9.3",
"/home/runner/work/ghaction-upx/ghaction-upx" "/home/runner/work/ghaction-upx/ghaction-upx"
] ]
], ],
"_from": "qs@6.9.1", "_from": "qs@6.9.3",
"_id": "qs@6.9.1", "_id": "qs@6.9.3",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA==", "_integrity": "sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw==",
"_location": "/qs", "_location": "/qs",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "version",
"registry": true, "registry": true,
"raw": "qs@6.9.1", "raw": "qs@6.9.3",
"name": "qs", "name": "qs",
"escapedName": "qs", "escapedName": "qs",
"rawSpec": "6.9.1", "rawSpec": "6.9.3",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "6.9.1" "fetchSpec": "6.9.3"
}, },
"_requiredBy": [ "_requiredBy": [
"/typed-rest-client" "/typed-rest-client"
], ],
"_resolved": "https://registry.npmjs.org/qs/-/qs-6.9.1.tgz", "_resolved": "https://registry.npmjs.org/qs/-/qs-6.9.3.tgz",
"_spec": "6.9.1", "_spec": "6.9.3",
"_where": "/home/runner/work/ghaction-upx/ghaction-upx", "_where": "/home/runner/work/ghaction-upx/ghaction-upx",
"bugs": { "bugs": {
"url": "https://github.com/ljharb/qs/issues" "url": "https://github.com/ljharb/qs/issues"
@ -40,21 +40,21 @@
"dependencies": {}, "dependencies": {},
"description": "A querystring parser that supports nesting and arrays, with a depth limit", "description": "A querystring parser that supports nesting and arrays, with a depth limit",
"devDependencies": { "devDependencies": {
"@ljharb/eslint-config": "^15.0.0", "@ljharb/eslint-config": "^16.0.0",
"browserify": "^16.5.0", "browserify": "^16.5.0",
"covert": "^1.1.1", "covert": "^1.1.1",
"eclint": "^2.8.1", "eclint": "^2.8.1",
"eslint": "^6.6.0", "eslint": "^6.8.0",
"evalmd": "^0.0.19", "evalmd": "^0.0.19",
"for-each": "^0.3.3", "for-each": "^0.3.3",
"has-symbols": "^1.0.0", "has-symbols": "^1.0.1",
"iconv-lite": "^0.4.24", "iconv-lite": "^0.5.1",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.4",
"object-inspect": "^1.6.0", "object-inspect": "^1.7.0",
"qs-iconv": "^1.0.4", "qs-iconv": "^1.0.4",
"safe-publish-latest": "^1.1.3", "safe-publish-latest": "^1.1.4",
"safer-buffer": "^2.1.2", "safer-buffer": "^2.1.2",
"tape": "^4.11.0" "tape": "^5.0.0-next.5"
}, },
"engines": { "engines": {
"node": ">=0.6" "node": ">=0.6"
@ -62,6 +62,12 @@
"funding": { "funding": {
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
}, },
"greenkeeper": {
"ignore": [
"iconv-lite",
"mkdirp"
]
},
"homepage": "https://github.com/ljharb/qs", "homepage": "https://github.com/ljharb/qs",
"keywords": [ "keywords": [
"querystring", "querystring",
@ -83,12 +89,12 @@
"dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js", "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js",
"lint": "eslint lib/*.js test/*.js", "lint": "eslint lib/*.js test/*.js",
"postlint": "eclint check * lib/* test/*", "postlint": "eclint check * lib/* test/*",
"posttest": "npx aud", "posttest": "npx aud --production",
"prepublish": "safe-publish-latest && npm run dist", "prepublish": "safe-publish-latest && npm run dist",
"pretest": "npm run --silent readme && npm run --silent lint", "pretest": "npm run --silent readme && npm run --silent lint",
"readme": "evalmd README.md", "readme": "evalmd README.md",
"test": "npm run --silent coverage", "test": "npm run --silent coverage",
"tests-only": "node test" "tests-only": "node test"
}, },
"version": "6.9.1" "version": "6.9.3"
} }

16
node_modules/qs/test/parse.js generated vendored
View File

@ -400,6 +400,12 @@ test('parse()', function (t) {
st.end(); st.end();
}); });
t.test('parses values with comma as array divider', function (st) {
st.deepEqual(qs.parse({ foo: 'bar,tee' }, { comma: false }), { foo: 'bar,tee' });
st.deepEqual(qs.parse({ foo: 'bar,tee' }, { comma: true }), { foo: ['bar', 'tee'] });
st.end();
});
t.test('use number decoder, parses string that has one number with comma option enabled', function (st) { t.test('use number decoder, parses string that has one number with comma option enabled', function (st) {
var decoder = function (str, defaultDecoder, charset, type) { var decoder = function (str, defaultDecoder, charset, type) {
if (!isNaN(Number(str))) { if (!isNaN(Number(str))) {
@ -423,6 +429,14 @@ test('parse()', function (t) {
st.end(); st.end();
}); });
t.test('parses comma delimited array while having percent-encoded comma treated as normal text', function (st) {
st.deepEqual(qs.parse('foo=a%2Cb', { comma: true }), { foo: 'a,b' });
st.deepEqual(qs.parse('foo=a%2C%20b,d', { comma: true }), { foo: ['a, b', 'd'] });
st.deepEqual(qs.parse('foo=a%2C%20b,c%2C%20d', { comma: true }), { foo: ['a, b', 'c, d'] });
st.end();
});
t.test('parses an object in dot notation', function (st) { t.test('parses an object in dot notation', function (st) {
var input = { var input = {
'user.name': { 'pop[bob]': 3 }, 'user.name': { 'pop[bob]': 3 },
@ -599,7 +613,7 @@ test('parse()', function (t) {
st.deepEqual( st.deepEqual(
qs.parse('a[b]=c&a=toString', { plainObjects: true }), qs.parse('a[b]=c&a=toString', { plainObjects: true }),
{ a: { b: 'c', toString: true } }, { __proto__: null, a: { __proto__: null, b: 'c', toString: true } },
'can overwrite prototype with plainObjects true' 'can overwrite prototype with plainObjects true'
); );

3
node_modules/semver/package.json generated vendored
View File

@ -46,7 +46,8 @@
"/jest-util/make-dir", "/jest-util/make-dir",
"/jest-watcher/make-dir", "/jest-watcher/make-dir",
"/jest/make-dir", "/jest/make-dir",
"/node-notifier" "/node-notifier",
"/ts-jest"
], ],
"_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "_resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"_spec": "6.3.0", "_spec": "6.3.0",

View File

@ -74,5 +74,5 @@ export declare class RestClient {
uploadStream<T>(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, options?: IRequestOptions): Promise<IRestResponse<T>>; uploadStream<T>(verb: string, requestUrl: string, stream: NodeJS.ReadableStream, options?: IRequestOptions): Promise<IRestResponse<T>>;
private _headersFromOptions; private _headersFromOptions;
private static dateTimeDeserializer; private static dateTimeDeserializer;
private _processResponse; protected processResponse<T>(res: httpm.HttpClientResponse, options: IRequestOptions): Promise<IRestResponse<T>>;
} }

View File

@ -37,7 +37,7 @@ class RestClient {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let url = util.getUrl(requestUrl, this._baseUrl); let url = util.getUrl(requestUrl, this._baseUrl);
let res = yield this.client.options(url, this._headersFromOptions(options)); let res = yield this.client.options(url, this._headersFromOptions(options));
return this._processResponse(res, options); return this.processResponse(res, options);
}); });
} }
/** /**
@ -50,7 +50,7 @@ class RestClient {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let url = util.getUrl(resource, this._baseUrl, (options || {}).queryParameters); let url = util.getUrl(resource, this._baseUrl, (options || {}).queryParameters);
let res = yield this.client.get(url, this._headersFromOptions(options)); let res = yield this.client.get(url, this._headersFromOptions(options));
return this._processResponse(res, options); return this.processResponse(res, options);
}); });
} }
/** /**
@ -63,7 +63,7 @@ class RestClient {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let url = util.getUrl(resource, this._baseUrl); let url = util.getUrl(resource, this._baseUrl);
let res = yield this.client.del(url, this._headersFromOptions(options)); let res = yield this.client.del(url, this._headersFromOptions(options));
return this._processResponse(res, options); return this.processResponse(res, options);
}); });
} }
/** /**
@ -79,7 +79,7 @@ class RestClient {
let headers = this._headersFromOptions(options, true); let headers = this._headersFromOptions(options, true);
let data = JSON.stringify(resources, null, 2); let data = JSON.stringify(resources, null, 2);
let res = yield this.client.post(url, data, headers); let res = yield this.client.post(url, data, headers);
return this._processResponse(res, options); return this.processResponse(res, options);
}); });
} }
/** /**
@ -95,7 +95,7 @@ class RestClient {
let headers = this._headersFromOptions(options, true); let headers = this._headersFromOptions(options, true);
let data = JSON.stringify(resources, null, 2); let data = JSON.stringify(resources, null, 2);
let res = yield this.client.patch(url, data, headers); let res = yield this.client.patch(url, data, headers);
return this._processResponse(res, options); return this.processResponse(res, options);
}); });
} }
/** /**
@ -111,7 +111,7 @@ class RestClient {
let headers = this._headersFromOptions(options, true); let headers = this._headersFromOptions(options, true);
let data = JSON.stringify(resources, null, 2); let data = JSON.stringify(resources, null, 2);
let res = yield this.client.put(url, data, headers); let res = yield this.client.put(url, data, headers);
return this._processResponse(res, options); return this.processResponse(res, options);
}); });
} }
uploadStream(verb, requestUrl, stream, options) { uploadStream(verb, requestUrl, stream, options) {
@ -119,7 +119,7 @@ class RestClient {
let url = util.getUrl(requestUrl, this._baseUrl); let url = util.getUrl(requestUrl, this._baseUrl);
let headers = this._headersFromOptions(options, true); let headers = this._headersFromOptions(options, true);
let res = yield this.client.sendStream(verb, url, stream, headers); let res = yield this.client.sendStream(verb, url, stream, headers);
return this._processResponse(res, options); return this.processResponse(res, options);
}); });
} }
_headersFromOptions(options, contentType) { _headersFromOptions(options, contentType) {
@ -148,7 +148,7 @@ class RestClient {
} }
return value; return value;
} }
_processResponse(res, options) { processResponse(res, options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
const statusCode = res.message.statusCode; const statusCode = res.message.statusCode;

View File

@ -111,8 +111,9 @@ function obtainContentCharset(response) {
// |__ matches would be ['charset=utf-8', 'utf-8', index: 18, input: 'application/json; charset=utf-8'] // |__ matches would be ['charset=utf-8', 'utf-8', index: 18, input: 'application/json; charset=utf-8']
// |_____ matches[1] would have the charset :tada: , in our example it's utf-8 // |_____ matches[1] would have the charset :tada: , in our example it's utf-8
// However, if the matches Array was empty or no charset found, 'utf-8' would be returned by default. // However, if the matches Array was empty or no charset found, 'utf-8' would be returned by default.
const nodeSupportedEncodings = ['ascii', 'utf8', 'utf16le', 'ucs2', 'base64', 'binary', 'hex'];
const contentType = response.message.headers['content-type'] || ''; const contentType = response.message.headers['content-type'] || '';
const matches = contentType.match(/charset=([^;,\r\n]+)/i); const matches = contentType.match(/charset=([^;,\r\n]+)/i);
return (matches && matches[1]) ? matches[1] : 'utf-8'; return (matches && matches[1] && nodeSupportedEncodings.indexOf(matches[1]) != -1) ? matches[1] : 'utf-8';
} }
exports.obtainContentCharset = obtainContentCharset; exports.obtainContentCharset = obtainContentCharset;

View File

@ -1,31 +1,31 @@
{ {
"_args": [ "_args": [
[ [
"typed-rest-client@1.7.2", "typed-rest-client@1.7.3",
"/home/runner/work/ghaction-upx/ghaction-upx" "/home/runner/work/ghaction-upx/ghaction-upx"
] ]
], ],
"_from": "typed-rest-client@1.7.2", "_from": "typed-rest-client@1.7.3",
"_id": "typed-rest-client@1.7.2", "_id": "typed-rest-client@1.7.3",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-6ENgPdTH7s2Xcd6mBaahyMLBoXPi0LNe75E1T0RFOdhqN9ENpZmf3P5iloOlJUDaHYrucPPzMrBybr6BdS2URg==", "_integrity": "sha512-CwTpx/TkRHGZoHkJhBcp4X8K3/WtlzSHVQR0OIFnt10j4tgy4ypgq/SrrgVpA1s6tAL49Q6J3R5C0Cgfh2ddqA==",
"_location": "/typed-rest-client", "_location": "/typed-rest-client",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "version",
"registry": true, "registry": true,
"raw": "typed-rest-client@1.7.2", "raw": "typed-rest-client@1.7.3",
"name": "typed-rest-client", "name": "typed-rest-client",
"escapedName": "typed-rest-client", "escapedName": "typed-rest-client",
"rawSpec": "1.7.2", "rawSpec": "1.7.3",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "1.7.2" "fetchSpec": "1.7.3"
}, },
"_requiredBy": [ "_requiredBy": [
"/" "/"
], ],
"_resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.7.2.tgz", "_resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.7.3.tgz",
"_spec": "1.7.2", "_spec": "1.7.3",
"_where": "/home/runner/work/ghaction-upx/ghaction-upx", "_where": "/home/runner/work/ghaction-upx/ghaction-upx",
"author": { "author": {
"name": "Microsoft Corporation" "name": "Microsoft Corporation"
@ -73,5 +73,5 @@
"units": "node make.js units", "units": "node make.js units",
"validate": "node make.js validate" "validate": "node make.js validate"
}, },
"version": "1.7.2" "version": "1.7.3"
} }