diff --git a/core/base-service/auth-helper.js b/core/base-service/auth-helper.js index 8c9c7976be9722f2e54cee84beb58b2a58c5f42b..05f9a7ed0e0e0b864c413898b233c888e50b9170 100644 --- a/core/base-service/auth-helper.js +++ b/core/base-service/auth-helper.js @@ -74,7 +74,7 @@ class AuthHelper { } static _isInsecureSslRequest({ options = {} }) { - const { strictSSL = true } = options + const strictSSL = options?.https?.rejectUnauthorized ?? true return strictSSL !== true } @@ -107,8 +107,8 @@ class AuthHelper { } get _basicAuth() { - const { _user: user, _pass: pass } = this - return this.isConfigured ? { user, pass } : undefined + const { _user: username, _pass: password } = this + return this.isConfigured ? { username, password } : undefined } /* @@ -131,7 +131,7 @@ class AuthHelper { const { options, ...rest } = requestParams return { options: { - auth, + ...auth, ...options, }, ...rest, @@ -181,11 +181,13 @@ class AuthHelper { } static _mergeQueryParams(requestParams, query) { - const { options: { qs: existingQuery, ...restOptions } = {}, ...rest } = - requestParams + const { + options: { searchParams: existingQuery, ...restOptions } = {}, + ...rest + } = requestParams return { options: { - qs: { + searchParams: { ...existingQuery, ...query, }, diff --git a/core/base-service/auth-helper.spec.js b/core/base-service/auth-helper.spec.js index fd36f950575acdd157eb5902de763490d59254ec..3f0e52206af24cf99cce82433f2b4150361c2cd1 100644 --- a/core/base-service/auth-helper.spec.js +++ b/core/base-service/auth-helper.spec.js @@ -104,14 +104,14 @@ describe('AuthHelper', function () { { userKey: 'myci_user', passKey: 'myci_pass' }, { myci_user: 'admin', myci_pass: 'abc123' } ), - ]).expect({ user: 'admin', pass: 'abc123' }) + ]).expect({ username: 'admin', password: 'abc123' }) given({ userKey: 'myci_user' }, { myci_user: 'admin' }).expect({ - user: 'admin', - pass: undefined, + username: 'admin', + password: undefined, }) given({ passKey: 'myci_pass' }, { myci_pass: 'abc123' }).expect({ - user: undefined, - pass: 'abc123', + username: undefined, + password: 'abc123', }) given({ userKey: 'myci_user', passKey: 'myci_pass' }, {}).expect( undefined @@ -120,8 +120,8 @@ describe('AuthHelper', function () { { passKey: 'myci_pass', defaultToEmptyStringForUser: true }, { myci_pass: 'abc123' } ).expect({ - user: '', - pass: 'abc123', + username: '', + password: 'abc123', }) }) }) @@ -131,15 +131,18 @@ describe('AuthHelper', function () { forCases([ given({ url: 'http://example.test' }), given({ url: 'http://example.test', options: {} }), - given({ url: 'http://example.test', options: { strictSSL: true } }), given({ url: 'http://example.test', - options: { strictSSL: undefined }, + options: { https: { rejectUnauthorized: true } }, + }), + given({ + url: 'http://example.test', + options: { https: { rejectUnauthorized: undefined } }, }), ]).expect(false) given({ url: 'http://example.test', - options: { strictSSL: false }, + options: { https: { rejectUnauthorized: false } }, }).expect(true) }) }) @@ -163,7 +166,9 @@ describe('AuthHelper', function () { }) it('throws for insecure requests', function () { expect(() => - authHelper.enforceStrictSsl({ options: { strictSSL: false } }) + authHelper.enforceStrictSsl({ + options: { https: { rejectUnauthorized: false } }, + }) ).to.throw(InvalidParameter) }) }) @@ -185,7 +190,9 @@ describe('AuthHelper', function () { }) it('does not throw for insecure requests', function () { expect(() => - authHelper.enforceStrictSsl({ options: { strictSSL: false } }) + authHelper.enforceStrictSsl({ + options: { https: { rejectUnauthorized: false } }, + }) ).not.to.throw() }) }) @@ -220,7 +227,7 @@ describe('AuthHelper', function () { test(shouldAuthenticateRequest, () => { given({ url: 'https://myci.test/api', - options: { strictSSL: false }, + options: { https: { rejectUnauthorized: false } }, }).expect(false) }) }) @@ -258,7 +265,7 @@ describe('AuthHelper', function () { test(shouldAuthenticateRequest, () => { given({ url: 'https://myci.test', - options: { strictSSL: false }, + options: { https: { rejectUnauthorized: false } }, }).expect(true) }) }) @@ -323,7 +330,8 @@ describe('AuthHelper', function () { }).expect({ url: 'https://myci.test/api', options: { - auth: { user: 'admin', pass: 'abc123' }, + username: 'admin', + password: 'abc123', }, }) given({ @@ -335,7 +343,8 @@ describe('AuthHelper', function () { url: 'https://myci.test/api', options: { headers: { Accept: 'application/json' }, - auth: { user: 'admin', pass: 'abc123' }, + username: 'admin', + password: 'abc123', }, }) }) @@ -366,7 +375,7 @@ describe('AuthHelper', function () { expect(() => withBasicAuth({ url: 'https://myci.test/api', - options: { strictSSL: false }, + options: { https: { rejectUnauthorized: false } }, }) ).to.throw(InvalidParameter) }) diff --git a/core/base-service/base-graphql.js b/core/base-service/base-graphql.js index bbdcb9224802c2a2a8c9e2e3c4608bd9e46e7a1c..694a2f272012554f4656467e8aeb426005739775 100644 --- a/core/base-service/base-graphql.js +++ b/core/base-service/base-graphql.js @@ -38,8 +38,8 @@ class BaseGraphqlService extends BaseService { * representing the query clause of GraphQL POST body * e.g. gql`{ query { ... } }` * @param {object} attrs.variables Variables clause of GraphQL POST body - * @param {object} [attrs.options={}] Options to pass to request. See - * [documentation](https://github.com/request/request#requestoptions-callback) + * @param {object} [attrs.options={}] Options to pass to got. See + * [documentation](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md) * @param {object} [attrs.httpErrorMessages={}] Key-value map of HTTP status codes * and custom error messages e.g: `{ 404: 'package not found' }`. * This can be used to extend or override the @@ -53,7 +53,7 @@ class BaseGraphqlService extends BaseService { * The default is to return the first entry of the `errors` array as * an InvalidResponse. * @returns {object} Parsed response - * @see https://github.com/request/request#requestoptions-callback + * @see https://github.com/sindresorhus/got/blob/main/documentation/2-options.md */ async _requestGraphql({ schema, diff --git a/core/base-service/base-graphql.spec.js b/core/base-service/base-graphql.spec.js index ee59b8ddecd87ba9061be0c341b64f2f9544a8fb..dcd6c150f15bc192670b88d25625cc7df4edcc34 100644 --- a/core/base-service/base-graphql.spec.js +++ b/core/base-service/base-graphql.spec.js @@ -66,7 +66,7 @@ describe('BaseGraphqlService', function () { requiredString } `, - options: { qs: { queryParam: 123 } }, + options: { searchParams: { queryParam: 123 } }, }) return { message: value } } @@ -83,7 +83,7 @@ describe('BaseGraphqlService', function () { body: '{"query":"{\\n requiredString\\n}\\n","variables":{}}', headers: { Accept: 'application/json' }, method: 'POST', - qs: { queryParam: 123 }, + searchParams: { queryParam: 123 }, } ) }) diff --git a/core/base-service/base-json.js b/core/base-service/base-json.js index 7f4730d2d2058f368fea4e43166cbd73da50d37f..ebabf1a41652d08c9a845863642c6f48273f0d12 100644 --- a/core/base-service/base-json.js +++ b/core/base-service/base-json.js @@ -28,14 +28,14 @@ class BaseJsonService extends BaseService { * @param {object} attrs Refer to individual attrs * @param {Joi} attrs.schema Joi schema to validate the response against * @param {string} attrs.url URL to request - * @param {object} [attrs.options={}] Options to pass to request. See - * [documentation](https://github.com/request/request#requestoptions-callback) + * @param {object} [attrs.options={}] Options to pass to got. See + * [documentation](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md) * @param {object} [attrs.errorMessages={}] Key-value map of status codes * and custom error messages e.g: `{ 404: 'package not found' }`. * This can be used to extend or override the * [default](https://github.com/badges/shields/blob/master/core/base-service/check-error-response.js#L5) * @returns {object} Parsed response - * @see https://github.com/request/request#requestoptions-callback + * @see https://github.com/sindresorhus/got/blob/main/documentation/2-options.md */ async _requestJson({ schema, url, options = {}, errorMessages = {} }) { const mergedOptions = { diff --git a/core/base-service/base-json.spec.js b/core/base-service/base-json.spec.js index 45665e470289369b6cfc87530881e0c9a73f9bbf..3dac0f7160fdd2aaa92dc279c698684ecc034d81 100644 --- a/core/base-service/base-json.spec.js +++ b/core/base-service/base-json.spec.js @@ -52,7 +52,7 @@ describe('BaseJsonService', function () { const { value } = await this._requestJson({ schema: dummySchema, url: 'http://example.com/foo.json', - options: { method: 'POST', qs: { queryParam: 123 } }, + options: { method: 'POST', searchParams: { queryParam: 123 } }, }) return { message: value } } @@ -68,7 +68,7 @@ describe('BaseJsonService', function () { { headers: { Accept: 'application/json' }, method: 'POST', - qs: { queryParam: 123 }, + searchParams: { queryParam: 123 }, } ) }) diff --git a/core/base-service/base-svg-scraping.js b/core/base-service/base-svg-scraping.js index 993e0b584bdc50463bb2b5e25b67c0af9345baf3..a1cf98185761105b8454c76dae23fd11692e744a 100644 --- a/core/base-service/base-svg-scraping.js +++ b/core/base-service/base-svg-scraping.js @@ -51,14 +51,14 @@ class BaseSvgScrapingService extends BaseService { * @param {RegExp} attrs.valueMatcher * RegExp to match the value we want to parse from the SVG * @param {string} attrs.url URL to request - * @param {object} [attrs.options={}] Options to pass to request. See - * [documentation](https://github.com/request/request#requestoptions-callback) + * @param {object} [attrs.options={}] Options to pass to got. See + * [documentation](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md) * @param {object} [attrs.errorMessages={}] Key-value map of status codes * and custom error messages e.g: `{ 404: 'package not found' }`. * This can be used to extend or override the * [default](https://github.com/badges/shields/blob/master/core/base-service/check-error-response.js#L5) * @returns {object} Parsed response - * @see https://github.com/request/request#requestoptions-callback + * @see https://github.com/sindresorhus/got/blob/main/documentation/2-options.md */ async _requestSvg({ schema, diff --git a/core/base-service/base-svg-scraping.spec.js b/core/base-service/base-svg-scraping.spec.js index 728f3bd188c7b3de07a5156d926207139f745cf4..c03943ecfd9a82c6b9114eb29fc30debd1609ffc 100644 --- a/core/base-service/base-svg-scraping.spec.js +++ b/core/base-service/base-svg-scraping.spec.js @@ -66,7 +66,7 @@ describe('BaseSvgScrapingService', function () { url: 'http://example.com/foo.svg', options: { method: 'POST', - qs: { queryParam: 123 }, + searchParams: { queryParam: 123 }, }, }) return { message } @@ -83,7 +83,7 @@ describe('BaseSvgScrapingService', function () { { method: 'POST', headers: { Accept: 'image/svg+xml' }, - qs: { queryParam: 123 }, + searchParams: { queryParam: 123 }, } ) }) diff --git a/core/base-service/base-xml.js b/core/base-service/base-xml.js index ee0c5e9020a0b5b0a0e7d95581d09c8422403029..1ea813a16e817e3976e2ea4de2523509d7fe6013 100644 --- a/core/base-service/base-xml.js +++ b/core/base-service/base-xml.js @@ -22,8 +22,8 @@ class BaseXmlService extends BaseService { * @param {object} attrs Refer to individual attrs * @param {Joi} attrs.schema Joi schema to validate the response against * @param {string} attrs.url URL to request - * @param {object} [attrs.options={}] Options to pass to request. See - * [documentation](https://github.com/request/request#requestoptions-callback) + * @param {object} [attrs.options={}] Options to pass to got. See + * [documentation](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md) * @param {object} [attrs.errorMessages={}] Key-value map of status codes * and custom error messages e.g: `{ 404: 'package not found' }`. * This can be used to extend or override the @@ -31,7 +31,7 @@ class BaseXmlService extends BaseService { * @param {object} [attrs.parserOptions={}] Options to pass to fast-xml-parser. See * [documentation](https://github.com/NaturalIntelligence/fast-xml-parser#xml-to-json) * @returns {object} Parsed response - * @see https://github.com/request/request#requestoptions-callback + * @see https://github.com/sindresorhus/got/blob/main/documentation/2-options.md * @see https://github.com/NaturalIntelligence/fast-xml-parser#xml-to-json */ async _requestXml({ diff --git a/core/base-service/base-xml.spec.js b/core/base-service/base-xml.spec.js index 8db8dfc6f7a10e581128c20949d029aa308d4188..5a7ecdad2a63fb7d1a078a8c3b26c9dce24a8172 100644 --- a/core/base-service/base-xml.spec.js +++ b/core/base-service/base-xml.spec.js @@ -54,7 +54,7 @@ describe('BaseXmlService', function () { const { requiredString } = await this._requestXml({ schema: dummySchema, url: 'http://example.com/foo.xml', - options: { method: 'POST', qs: { queryParam: 123 } }, + options: { method: 'POST', searchParams: { queryParam: 123 } }, }) return { message: requiredString } } @@ -70,7 +70,7 @@ describe('BaseXmlService', function () { { headers: { Accept: 'application/xml, text/xml' }, method: 'POST', - qs: { queryParam: 123 }, + searchParams: { queryParam: 123 }, } ) }) diff --git a/core/base-service/base-yaml.js b/core/base-service/base-yaml.js index 0dd75930cac429ad05bb5f2eafbe68f8d0592eb5..85e08f2d25c188381542d5efcea2b6ae9d601ef8 100644 --- a/core/base-service/base-yaml.js +++ b/core/base-service/base-yaml.js @@ -21,15 +21,15 @@ class BaseYamlService extends BaseService { * @param {object} attrs Refer to individual attrs * @param {Joi} attrs.schema Joi schema to validate the response against * @param {string} attrs.url URL to request - * @param {object} [attrs.options={}] Options to pass to request. See - * [documentation](https://github.com/request/request#requestoptions-callback) + * @param {object} [attrs.options={}] Options to pass to got. See + * [documentation](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md) * @param {object} [attrs.errorMessages={}] Key-value map of status codes * and custom error messages e.g: `{ 404: 'package not found' }`. * This can be used to extend or override the * [default](https://github.com/badges/shields/blob/master/core/base-service/check-error-response.js#L5) * @param {object} [attrs.encoding='utf8'] Character encoding * @returns {object} Parsed response - * @see https://github.com/request/request#requestoptions-callback + * @see https://github.com/sindresorhus/got/blob/main/documentation/2-options.md */ async _requestYaml({ schema, diff --git a/core/base-service/base-yaml.spec.js b/core/base-service/base-yaml.spec.js index 50b42990c1701290318c47e5d971ba7180847a49..f52fb07efb2d4998641ee3efcd47330ea8093d08 100644 --- a/core/base-service/base-yaml.spec.js +++ b/core/base-service/base-yaml.spec.js @@ -71,7 +71,7 @@ describe('BaseYamlService', function () { const { requiredString } = await this._requestYaml({ schema: dummySchema, url: 'http://example.com/foo.yaml', - options: { method: 'POST', qs: { queryParam: 123 } }, + options: { method: 'POST', searchParams: { queryParam: 123 } }, }) return { message: requiredString } } @@ -90,7 +90,7 @@ describe('BaseYamlService', function () { 'text/x-yaml, text/yaml, application/x-yaml, application/yaml, text/plain', }, method: 'POST', - qs: { queryParam: 123 }, + searchParams: { queryParam: 123 }, } ) }) diff --git a/core/base-service/base.js b/core/base-service/base.js index 8986cbf239f5cf1ec0181d07e2260c391122bf47..4cd0039695a731201407916bab07251123d8f06e 100644 --- a/core/base-service/base.js +++ b/core/base-service/base.js @@ -108,11 +108,14 @@ class BaseService { * * See also the config schema in `./server.js` and `doc/server-secrets.md`. * - * To use the configured auth in the handler or fetch method, pass the - * credentials to the request. For example: - * - `{ options: { auth: this.authHelper.basicAuth } }` - * - `{ options: { headers: this.authHelper.bearerAuthHeader } }` - * - `{ options: { qs: { token: this.authHelper._pass } } }` + * To use the configured auth in the handler or fetch method, wrap the + * _request() input params in a call to one of: + * - this.authHelper.withBasicAuth() + * - this.authHelper.withBearerAuthHeader() + * - this.authHelper.withQueryStringAuth() + * + * For example: + * this._request(this.authHelper.withBasicAuth({ url, schema, options })) * * @abstract * @type {module:core/base-service/base~Auth} @@ -217,10 +220,10 @@ class BaseService { const logTrace = (...args) => trace.logTrace('fetch', ...args) let logUrl = url const logOptions = Object.assign({}, options) - if ('qs' in options) { - const params = new URLSearchParams(options.qs) + if ('searchParams' in options) { + const params = new URLSearchParams(options.searchParams) logUrl = `${url}?${params.toString()}` - delete logOptions.qs + delete logOptions.searchParams } logTrace( emojic.bowAndArrow, diff --git a/core/base-service/got.js b/core/base-service/got.js index b49591f4764b5d05a869afdecd2ef8b810ab12bc..b62fa24502b10251d8dc510ccf43ec40454b8d6e 100644 --- a/core/base-service/got.js +++ b/core/base-service/got.js @@ -3,50 +3,8 @@ import { Inaccessible, InvalidResponse } from './errors.js' const userAgent = 'Shields.io/2003a' -function requestOptions2GotOptions(options) { - const requestOptions = Object.assign({}, options) - const gotOptions = {} - const interchangableOptions = ['body', 'form', 'headers', 'method', 'url'] - - interchangableOptions.forEach(function (opt) { - if (opt in requestOptions) { - gotOptions[opt] = requestOptions[opt] - delete requestOptions[opt] - } - }) - - if ('qs' in requestOptions) { - gotOptions.searchParams = requestOptions.qs - delete requestOptions.qs - } - - if ('gzip' in requestOptions) { - gotOptions.decompress = requestOptions.gzip - delete requestOptions.gzip - } - - if ('strictSSL' in requestOptions) { - gotOptions.https = { - rejectUnauthorized: requestOptions.strictSSL, - } - delete requestOptions.strictSSL - } - - if ('auth' in requestOptions) { - gotOptions.username = requestOptions.auth.user - gotOptions.password = requestOptions.auth.pass - delete requestOptions.auth - } - - if (Object.keys(requestOptions).length > 0) { - throw new Error(`Found unrecognised options ${Object.keys(requestOptions)}`) - } - - return gotOptions -} - async function sendRequest(gotWrapper, url, options) { - const gotOptions = requestOptions2GotOptions(options) + const gotOptions = Object.assign({}, options) gotOptions.throwHttpErrors = false gotOptions.retry = 0 gotOptions.headers = gotOptions.headers || {} @@ -94,4 +52,4 @@ function fetchFactory(fetchLimitBytes = TEN_MB) { return sendRequest.bind(sendRequest, gotWithLimit) } -export { requestOptions2GotOptions, fetchFactory, userAgent } +export { fetchFactory, userAgent } diff --git a/core/base-service/got.spec.js b/core/base-service/got.spec.js index 185052d16384e5993790d850c521497b3d63c8ee..e592ed675cb00717d4e6a3a3d9a3c6c7295e868a 100644 --- a/core/base-service/got.spec.js +++ b/core/base-service/got.spec.js @@ -1,43 +1,8 @@ import { expect } from 'chai' import nock from 'nock' -import { requestOptions2GotOptions, fetchFactory } from './got.js' +import { fetchFactory } from './got.js' import { Inaccessible, InvalidResponse } from './errors.js' -describe('requestOptions2GotOptions function', function () { - it('translates valid options', function () { - expect( - requestOptions2GotOptions({ - body: 'body', - form: 'form', - headers: 'headers', - method: 'method', - url: 'url', - qs: 'qs', - gzip: 'gzip', - strictSSL: 'strictSSL', - auth: { user: 'user', pass: 'pass' }, - }) - ).to.deep.equal({ - body: 'body', - form: 'form', - headers: 'headers', - method: 'method', - url: 'url', - searchParams: 'qs', - decompress: 'gzip', - https: { rejectUnauthorized: 'strictSSL' }, - username: 'user', - password: 'pass', - }) - }) - - it('throws if unrecognised options are found', function () { - expect(() => - requestOptions2GotOptions({ body: 'body', foobar: 'foobar' }) - ).to.throw(Error, 'Found unrecognised options foobar') - }) -}) - describe('got wrapper', function () { it('should not throw an error if the response <= fetchLimitBytes', async function () { nock('https://www.google.com') diff --git a/doc/TUTORIAL.md b/doc/TUTORIAL.md index 3315790fc31770f226925ca9b2e7994f30ea5142..ab81402c3ea622f962cf67b6da3295277c70f338 100644 --- a/doc/TUTORIAL.md +++ b/doc/TUTORIAL.md @@ -228,14 +228,14 @@ Description of the code: 9. Working our way upward, the `async fetch()` method is responsible for calling an API endpoint to get data. Extending `BaseJsonService` gives us the helper function `_requestJson()`. Note here that we pass the schema we defined in step 4 as an argument. `_requestJson()` will deal with validating the response against the schema and throwing an error if necessary. - `_requestJson()` automatically adds an Accept header, checks the status code, parses the response as JSON, and returns the parsed response. - - `_requestJson()` uses [request](https://github.com/request/request) to perform the HTTP request. Options can be passed to request, including method, query string, and headers. If headers are provided they will override the ones automatically set by `_requestJson()`. There is no need to specify json, as the JSON parsing is handled by `_requestJson()`. See the `request` docs for [supported options](https://github.com/request/request#requestoptions-callback). + - `_requestJson()` uses [got](https://github.com/sindresorhus/got) to perform the HTTP request. Options can be passed to got, including method, query string, and headers. If headers are provided they will override the ones automatically set by `_requestJson()`. There is no need to specify json, as the JSON parsing is handled by `_requestJson()`. See the `got` docs for [supported options](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md). - Error messages corresponding to each status code can be returned by passing a dictionary of status codes -> messages in `errorMessages`. - A more complex call to `_requestJson()` might look like this: ```js return this._requestJson({ schema: mySchema, url, - options: { qs: { branch: 'master' } }, + options: { searchParams: { branch: 'master' } }, errorMessages: { 401: 'private application not supported', 404: 'application not found', diff --git a/services/aur/aur.service.js b/services/aur/aur.service.js index c854ce94d46fa00d65d1d9ff406ed0eebf4f2fd2..61430f5b68f1591fd885d717c6c4f6fbdf534362 100644 --- a/services/aur/aur.service.js +++ b/services/aur/aur.service.js @@ -43,7 +43,7 @@ class BaseAurService extends BaseJsonService { return this._requestJson({ schema: aurSchema, url: 'https://aur.archlinux.org/rpc.php', - options: { qs: { v: 5, type: 'info', arg: packageName } }, + options: { searchParams: { v: 5, type: 'info', arg: packageName } }, }) } } diff --git a/services/azure-devops/azure-devops-base.js b/services/azure-devops/azure-devops-base.js index 184530bde7c5b8c4457e2606ca9d9df8b55d7bf7..6b01bea8466d2d1a0cffc1facb34386155a89d57 100644 --- a/services/azure-devops/azure-devops-base.js +++ b/services/azure-devops/azure-devops-base.js @@ -40,7 +40,7 @@ export default class AzureDevOpsBase extends BaseJsonService { // Microsoft documentation: https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/list?view=azure-devops-rest-5.0 const url = `https://dev.azure.com/${organization}/${project}/_apis/build/builds` const options = { - qs: { + searchParams: { definitions: definitionId, $top: 1, statusFilter: 'completed', @@ -49,7 +49,7 @@ export default class AzureDevOpsBase extends BaseJsonService { } if (branch) { - options.qs.branchName = `refs/heads/${branch}` + options.searchParams.branchName = `refs/heads/${branch}` } const json = await this.fetch({ diff --git a/services/azure-devops/azure-devops-build.service.js b/services/azure-devops/azure-devops-build.service.js index 8485fa49fe502d6960f9a9bea8d4d081588bcc42..a4c2bc93b702dc85cdf6351547a02d8310a2e5e1 100644 --- a/services/azure-devops/azure-devops-build.service.js +++ b/services/azure-devops/azure-devops-build.service.js @@ -104,7 +104,7 @@ export default class AzureDevOpsBuild extends BaseSvgScrapingService { // Microsoft documentation: https://docs.microsoft.com/en-us/rest/api/vsts/build/status/get const { status } = await fetch(this, { url: `https://dev.azure.com/${organization}/${projectId}/_apis/build/status/${definitionId}`, - qs: { + searchParams: { branchName: branch, stageName: stage, jobName: job, diff --git a/services/azure-devops/azure-devops-coverage.service.js b/services/azure-devops/azure-devops-coverage.service.js index 4234b36f48d6a112cca2006b1bb773ea4350cbad..eb5b7eeb797c131b3e597732ed52e88404339c18 100644 --- a/services/azure-devops/azure-devops-coverage.service.js +++ b/services/azure-devops/azure-devops-coverage.service.js @@ -101,7 +101,7 @@ export default class AzureDevOpsCoverage extends AzureDevOpsBase { // Microsoft documentation: https://docs.microsoft.com/en-us/rest/api/azure/devops/test/code%20coverage/get%20build%20code%20coverage?view=azure-devops-rest-5.0 const url = `https://dev.azure.com/${organization}/${project}/_apis/test/codecoverage` const options = { - qs: { + searchParams: { buildId, 'api-version': '5.0-preview.1', }, diff --git a/services/azure-devops/azure-devops-helpers.js b/services/azure-devops/azure-devops-helpers.js index 67b457352a303063122b7eea247bd0f5e6b15867..e57f8c83472322f65b1c896e93baea3da819de67 100644 --- a/services/azure-devops/azure-devops-helpers.js +++ b/services/azure-devops/azure-devops-helpers.js @@ -15,12 +15,15 @@ const schema = Joi.object({ .required(), }).required() -async function fetch(serviceInstance, { url, qs = {}, errorMessages }) { +async function fetch( + serviceInstance, + { url, searchParams = {}, errorMessages } +) { // Microsoft documentation: https://docs.microsoft.com/en-us/rest/api/vsts/build/status/get const { message: status } = await serviceInstance._requestSvg({ schema, url, - options: { qs }, + options: { searchParams }, errorMessages, }) return { status } diff --git a/services/azure-devops/azure-devops-tests.service.js b/services/azure-devops/azure-devops-tests.service.js index 9e840bfe38fd72fe47d063246dcc6df8ee4d8848..8b10ebf4318f0de7969eba029369bfe649678b3e 100644 --- a/services/azure-devops/azure-devops-tests.service.js +++ b/services/azure-devops/azure-devops-tests.service.js @@ -160,7 +160,7 @@ export default class AzureDevOpsTests extends AzureDevOpsBase { return await this.fetch({ url: `https://dev.azure.com/${organization}/${project}/_apis/test/ResultSummaryByBuild`, options: { - qs: { buildId }, + searchParams: { buildId }, }, schema: buildTestResultSummarySchema, errorMessages, diff --git a/services/bitbucket/bitbucket-issues.service.js b/services/bitbucket/bitbucket-issues.service.js index 9bcf5a5b92fbdcc599ea4a77b8cb22d852c52ab5..38eafea3a3d5ac28fa11fefcf4f964feabcda9ae 100644 --- a/services/bitbucket/bitbucket-issues.service.js +++ b/services/bitbucket/bitbucket-issues.service.js @@ -44,7 +44,7 @@ function issueClassGenerator(raw) { schema: bitbucketIssuesSchema, // https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering#query-issues options: { - qs: { limit: 0, q: '(state = "new" OR state = "open")' }, + searchParams: { limit: 0, q: '(state = "new" OR state = "open")' }, }, errorMessages: { 403: 'private repo' }, }) diff --git a/services/bitbucket/bitbucket-pipelines.service.js b/services/bitbucket/bitbucket-pipelines.service.js index dc28820bcdb1ac08444cc73be757d44d6ddae792..29d0277d4b58c438453fcd1828a493625adc3e58 100644 --- a/services/bitbucket/bitbucket-pipelines.service.js +++ b/services/bitbucket/bitbucket-pipelines.service.js @@ -54,7 +54,7 @@ class BitbucketPipelines extends BaseJsonService { url, schema: bitbucketPipelinesSchema, options: { - qs: { + searchParams: { fields: 'values.state', page: 1, pagelen: 2, diff --git a/services/bitbucket/bitbucket-pull-request.service.js b/services/bitbucket/bitbucket-pull-request.service.js index add3ad820f96b056534473f6d190da21d328bf51..e1ad1a8117e91aaad99d404e0532eed033acbecd 100644 --- a/services/bitbucket/bitbucket-pull-request.service.js +++ b/services/bitbucket/bitbucket-pull-request.service.js @@ -86,7 +86,7 @@ function pullRequestClassGenerator(raw) { this.bitbucketAuthHelper.withBasicAuth({ url: `https://bitbucket.org/api/2.0/repositories/${user}/${repo}/pullrequests/`, schema, - options: { qs: { state: 'OPEN', limit: 0 } }, + options: { searchParams: { state: 'OPEN', limit: 0 } }, errorMessages, }) ) @@ -99,7 +99,7 @@ function pullRequestClassGenerator(raw) { url: `${server}/rest/api/1.0/projects/${user}/repos/${repo}/pull-requests`, schema, options: { - qs: { + searchParams: { state: 'OPEN', limit: 100, withProperties: false, diff --git a/services/bitrise/bitrise.service.js b/services/bitrise/bitrise.service.js index ee76f55972efb66c3e56c22da0b1c0272fc75b10..ea868086349ffcf9aa6c48791dd2fbed8215fa9f 100644 --- a/services/bitrise/bitrise.service.js +++ b/services/bitrise/bitrise.service.js @@ -53,7 +53,7 @@ export default class Bitrise extends BaseJsonService { url: `https://app.bitrise.io/app/${encodeURIComponent( appId )}/status.json`, - options: { qs: { token, branch } }, + options: { searchParams: { token, branch } }, schema, errorMessages: { 403: 'app not found or invalid token', diff --git a/services/bstats/bstats-players.service.js b/services/bstats/bstats-players.service.js index 5b8eccd36f7410b1cd5d9f63afca43ab6373ac2b..6e4f0658a9bd93e6978f66b784df2e521cd29de3 100644 --- a/services/bstats/bstats-players.service.js +++ b/services/bstats/bstats-players.service.js @@ -34,7 +34,7 @@ export default class BStatsPlayers extends BaseJsonService { return this._requestJson({ schema, options: { - qs: { + searchParams: { maxElements: 1, }, }, diff --git a/services/bstats/bstats-servers.service.js b/services/bstats/bstats-servers.service.js index f90f95397acd62c695bf4ea042c3842f7621be47..e0486eb810961277cc3815bb4c58d61905004a29 100644 --- a/services/bstats/bstats-servers.service.js +++ b/services/bstats/bstats-servers.service.js @@ -34,7 +34,7 @@ export default class BStatsServers extends BaseJsonService { return this._requestJson({ schema, options: { - qs: { + searchParams: { maxElements: 1, }, }, diff --git a/services/buildkite/buildkite.service.js b/services/buildkite/buildkite.service.js index c9cfb31648f7c2c2e327ea799a69bb3b1450a9f2..e881421cfca79cfc4b375c19b8dad2d9876bc6a2 100644 --- a/services/buildkite/buildkite.service.js +++ b/services/buildkite/buildkite.service.js @@ -35,7 +35,7 @@ export default class Buildkite extends BaseJsonService { async fetch({ identifier, branch }) { const url = `https://badge.buildkite.com/${identifier}.json` - const options = { qs: { branch } } + const options = { searchParams: { branch } } return this._requestJson({ schema, url, diff --git a/services/bundlephobia/bundlephobia.service.js b/services/bundlephobia/bundlephobia.service.js index 5609e0880ab72fd891ef3e485ae81e0ef1350dfb..c3fed6cdd1134a9a4602e35968d7129e43d01b91 100644 --- a/services/bundlephobia/bundlephobia.service.js +++ b/services/bundlephobia/bundlephobia.service.js @@ -79,7 +79,7 @@ export default class Bundlephobia extends BaseJsonService { const packageQuery = `${scope ? `${scope}/` : ''}${packageName}${ version ? `@${version}` : '' }` - const options = { qs: { package: packageQuery } } + const options = { searchParams: { package: packageQuery } } return this._requestJson({ schema, url: 'https://bundlephobia.com/api/size', diff --git a/services/circleci/circleci.service.js b/services/circleci/circleci.service.js index 2087af453136aa5043c1840ab1ba78db8ce8ee1c..11dd943cd3cf1d818467c6ec9dbc6ab117f80e77 100644 --- a/services/circleci/circleci.service.js +++ b/services/circleci/circleci.service.js @@ -56,7 +56,7 @@ class CircleCi extends BaseSvgScrapingService { url: `https://circleci.com/${vcs}/${user}/${repo}${branchClause}.svg`, // Note that the unusual 'circle-token' query param name is required. // https://circleci.com/docs/api/#get-authenticated - options: { qs: { style: 'shield', 'circle-token': token } }, + options: { searchParams: { style: 'shield', 'circle-token': token } }, errorMessages: { 404: 'project not found' }, }) return this.constructor.render({ status: message }) diff --git a/services/cirrus/cirrus.service.js b/services/cirrus/cirrus.service.js index 437f2d630ab3c2a859bae2e359d36599cce98588..24bc992321890d034b6b3e74ecb297df4e6e4449 100644 --- a/services/cirrus/cirrus.service.js +++ b/services/cirrus/cirrus.service.js @@ -65,7 +65,7 @@ export default class Cirrus extends BaseJsonService { const json = await this._requestJson({ schema, url: `https://api.cirrus-ci.com/github/${user}/${repo}.json`, - options: { qs: { branch, script, task } }, + options: { searchParams: { branch, script, task } }, }) return this.constructor.render(json) diff --git a/services/codacy/codacy-coverage.service.js b/services/codacy/codacy-coverage.service.js index efd229bce583f467518b7f7f13a5aea78e36d146..62c1d8a03042d4338f34d8edb58b6ed980bbdbff 100644 --- a/services/codacy/codacy-coverage.service.js +++ b/services/codacy/codacy-coverage.service.js @@ -51,7 +51,7 @@ export default class CodacyCoverage extends BaseSvgScrapingService { url: `https://api.codacy.com/project/badge/coverage/${encodeURIComponent( projectId )}`, - options: { qs: { branch } }, + options: { searchParams: { branch } }, valueMatcher: /text-anchor="middle">([^<>]+)<\/text>/, errorMessages: { 404: 'project not found', diff --git a/services/codacy/codacy-grade.service.js b/services/codacy/codacy-grade.service.js index 17f88a2a42befe97da8055d082813e41ead45c93..91fec3bfac492bb8a444a706b968a1d8eb76376f 100644 --- a/services/codacy/codacy-grade.service.js +++ b/services/codacy/codacy-grade.service.js @@ -50,7 +50,7 @@ export default class CodacyGrade extends BaseSvgScrapingService { url: `https://api.codacy.com/project/badge/grade/${encodeURIComponent( projectId )}`, - options: { qs: { branch } }, + options: { searchParams: { branch } }, errorMessages: { 404: 'project or branch not found' }, valueMatcher: /visibility="hidden">([^<>]+)<\/text>/, }) diff --git a/services/codeclimate/codeclimate-common.js b/services/codeclimate/codeclimate-common.js index b987317b0bf1d38e09e533e226d1d51ab5fd61c1..29a705aa76fff87b9f1b0ca0dd555143d151bd57 100644 --- a/services/codeclimate/codeclimate-common.js +++ b/services/codeclimate/codeclimate-common.js @@ -34,7 +34,7 @@ async function fetchRepo(serviceInstance, { user, repo }) { } = await serviceInstance._requestJson({ schema: repoSchema, url: 'https://api.codeclimate.com/v1/repos', - options: { qs: { github_slug: `${user}/${repo}` } }, + options: { searchParams: { github_slug: `${user}/${repo}` } }, }) if (repoInfo === undefined) { throw new NotFound({ prettyMessage: 'repo not found' }) diff --git a/services/codecov/codecov.service.js b/services/codecov/codecov.service.js index ecafc48cf9d8ff3eed618be745d9d91c9492ca05..e31a97c74d7d7feaf8979a4d0f681a7a7f8af840 100644 --- a/services/codecov/codecov.service.js +++ b/services/codecov/codecov.service.js @@ -151,7 +151,7 @@ export default class Codecov extends BaseSvgScrapingService { valueMatcher: svgValueMatcher, url, options: { - qs: { token, flag }, + searchParams: { token, flag }, }, errorMessages: token ? { 400: 'invalid token pattern' } : {}, }) diff --git a/services/codeship/codeship.service.js b/services/codeship/codeship.service.js index d9a8bde1d6637dc0d463133d6a3ccec7fb086b7e..78a412fb77db0f90d2470a54de895f2698727322 100644 --- a/services/codeship/codeship.service.js +++ b/services/codeship/codeship.service.js @@ -60,7 +60,7 @@ export default class Codeship extends BaseSvgScrapingService { return this._requestSvg({ schema, url, - options: { qs: { branch } }, + options: { searchParams: { branch } }, valueMatcher: /<g id="status_2">(?:[.\s\S]*)\/><\/g><g id="([\w\s]*)"/, }) } diff --git a/services/coveralls/coveralls.service.js b/services/coveralls/coveralls.service.js index 46b0d556a72a9b7c5fb69d35df409b8da6ba4cd0..840423bf1fc95abea5d1048dc95077872cb42d1f 100644 --- a/services/coveralls/coveralls.service.js +++ b/services/coveralls/coveralls.service.js @@ -48,7 +48,7 @@ export default class Coveralls extends BaseJsonService { vcsType || 'github' }/${user}/${repo}.json` const options = { - qs: { + searchParams: { // The API returns the latest result (across any branch) if no branch is explicitly specified, // whereas the Coveralls native badge (and the Shields.io badges for Coveralls) show // the coverage for the default branch if no branch is explicitly specified. If the user diff --git a/services/debian/debian.service.js b/services/debian/debian.service.js index 404cc75b3d4692eba9f02796db88d4ec4c45f3ee..1c70f1746f44416feb7bb655e56f818c15bbc395 100644 --- a/services/debian/debian.service.js +++ b/services/debian/debian.service.js @@ -38,7 +38,7 @@ export default class Debian extends BaseJsonService { schema, url: 'https://api.ftp-master.debian.org/madison', options: { - qs: { + searchParams: { f: 'json', s: distribution, package: packageName, diff --git a/services/dependabot/dependabot.service.js b/services/dependabot/dependabot.service.js index 57d2cf3a311063e9b40358e5ffb90f2151304833..376c5d93abe097d059cf0b4ec297735e186f9d6d 100644 --- a/services/dependabot/dependabot.service.js +++ b/services/dependabot/dependabot.service.js @@ -39,7 +39,9 @@ export default class DependabotSemverCompatibility extends BaseJsonService { return this._requestJson({ schema, url, - options: { qs: this._getQuery({ packageManager, dependencyName }) }, + options: { + searchParams: this._getQuery({ packageManager, dependencyName }), + }, }) } diff --git a/services/docker/docker-cloud-common-fetch.js b/services/docker/docker-cloud-common-fetch.js index 51a5317348a6a6522fe50912a5e09384de1caeda..f0047cb576f7ae0a9343a1bbe0cc77ebddd16c12 100644 --- a/services/docker/docker-cloud-common-fetch.js +++ b/services/docker/docker-cloud-common-fetch.js @@ -15,7 +15,7 @@ async function fetchBuild(serviceInstance, { user, repo }) { return serviceInstance._requestJson({ schema: cloudBuildSchema, url: `https://cloud.docker.com/api/build/v1/source`, - options: { qs: { image: `${user}/${repo}` } }, + options: { searchParams: { image: `${user}/${repo}` } }, errorMessages: { 404: 'repo not found' }, }) } diff --git a/services/drone/drone-build.service.js b/services/drone/drone-build.service.js index 5b5986efb6dc3f429b65db41f39d40c6f2b60d65..aa8ec477d154b4eb6cb9310a3ac3b85e56f4fc01 100644 --- a/services/drone/drone-build.service.js +++ b/services/drone/drone-build.service.js @@ -73,7 +73,7 @@ export default class DroneBuild extends BaseJsonService { schema, url: `${server}/api/repos/${user}/${repo}/builds/latest`, options: { - qs: { ref: branch ? `refs/heads/${branch}` : undefined }, + searchParams: { ref: branch ? `refs/heads/${branch}` : undefined }, }, errorMessages: { 401: 'repo not found or not authorized', diff --git a/services/endpoint-common.js b/services/endpoint-common.js index 1f3cf8d00cff6ab75627794efa099078e715646e..08d5ca031e5d17d00876816e7dde96b7b5ea1232 100644 --- a/services/endpoint-common.js +++ b/services/endpoint-common.js @@ -64,7 +64,7 @@ async function fetchEndpointData( schema: anySchema, url, errorMessages, - options: { gzip: true }, + options: { decompress: true }, }) return validateEndpointData(json, { prettyErrorMessage: validationPrettyErrorMessage, diff --git a/services/freecodecamp/freecodecamp-points.service.js b/services/freecodecamp/freecodecamp-points.service.js index acf8fb0daa59044022a90d2204eefddf02826a01..898ec7e5594b3c379fda6c455350dfa2640c5ceb 100644 --- a/services/freecodecamp/freecodecamp-points.service.js +++ b/services/freecodecamp/freecodecamp-points.service.js @@ -48,7 +48,7 @@ export default class FreeCodeCampPoints extends BaseJsonService { schema, url: `https://api.freecodecamp.org/api/users/get-public-profile`, options: { - qs: { + searchParams: { username, }, }, diff --git a/services/github/github-common-fetch.js b/services/github/github-common-fetch.js index 1cf6c72fd1f94ca6c872e4a2bbe86ec58bd054a7..25c9a8de196bc68828d0aff9c360fad844a32c18 100644 --- a/services/github/github-common-fetch.js +++ b/services/github/github-common-fetch.js @@ -33,7 +33,7 @@ async function fetchRepoContent( const { content } = await serviceInstance._requestJson({ schema: contentSchema, url: `/repos/${user}/${repo}/contents/${filename}`, - options: { qs: { ref: branch } }, + options: { searchParams: { ref: branch } }, errorMessages, }) diff --git a/services/github/github-contributors.service.js b/services/github/github-contributors.service.js index 6ad4c713e0a4ecca3d5541eb17c0f7c5e840e303..af9b2c6dd1916d6a2007ab9d2f8ead1c5b16fc56 100644 --- a/services/github/github-contributors.service.js +++ b/services/github/github-contributors.service.js @@ -38,7 +38,7 @@ export default class GithubContributors extends GithubAuthV3Service { const { res, buffer } = await this._request({ url: `/repos/${user}/${repo}/contributors`, - options: { qs: { page: '1', per_page: '1', anon: isAnon } }, + options: { searchParams: { page: '1', per_page: '1', anon: isAnon } }, errorMessages: errorMessagesFor('repo not found'), }) diff --git a/services/github/github-downloads.service.js b/services/github/github-downloads.service.js index 03b3ed99a426bf2506ab2b8e206057a39b2d03b6..a70d0c1ada3b4b9a4d6b55024d71ef5cfa1dc550 100644 --- a/services/github/github-downloads.service.js +++ b/services/github/github-downloads.service.js @@ -240,7 +240,7 @@ export default class GithubDownloads extends GithubAuthV3Service { const allReleases = await this._requestJson({ schema: releaseArraySchema, url: `/repos/${user}/${repo}/releases`, - options: { qs: { per_page: 500 } }, + options: { searchParams: { per_page: 500 } }, errorMessages: errorMessagesFor('repo not found'), }) releases = allReleases diff --git a/services/github/github-last-commit.service.js b/services/github/github-last-commit.service.js index b452fbe96b6d4176cf0bc81c89f3911a09f4db40..509f5422f6ebb614c29a7e7ad6dc4f4908b23ed8 100644 --- a/services/github/github-last-commit.service.js +++ b/services/github/github-last-commit.service.js @@ -59,7 +59,7 @@ export default class GithubLastCommit extends GithubAuthV3Service { async fetch({ user, repo, branch }) { return this._requestJson({ url: `/repos/${user}/${repo}/commits`, - options: { qs: { sha: branch } }, + options: { searchParams: { sha: branch } }, schema, errorMessages: errorMessagesFor(), }) diff --git a/services/github/github-search.service.js b/services/github/github-search.service.js index 361d1b9eb737a959ef1a2f6198334946021849bd..1770e5bca5ccec2749974cd098344780b752fb83 100644 --- a/services/github/github-search.service.js +++ b/services/github/github-search.service.js @@ -44,7 +44,7 @@ export default class GithubSearch extends GithubAuthV3Service { const { total_count: totalCount } = await this._requestJson({ url: '/search/code', options: { - qs: { + searchParams: { q: `${query} repo:${user}/${repo}`, }, }, diff --git a/services/github/github-workflow-status.service.js b/services/github/github-workflow-status.service.js index f5467d7b2aac81cdfef509e0a48f7b224a7b14e6..d1d47ca0bb634fb68311a0379e567e3a31bfe674 100644 --- a/services/github/github-workflow-status.service.js +++ b/services/github/github-workflow-status.service.js @@ -83,7 +83,7 @@ export default class GithubWorkflowStatus extends BaseSvgScrapingService { url: `https://github.com/${user}/${repo}/workflows/${encodeURIComponent( workflow )}/badge.svg`, - options: { qs: { branch, event } }, + options: { searchParams: { branch, event } }, valueMatcher: />([^<>]+)<\/tspan><\/text><\/g><path/, errorMessages: { 404: 'repo, branch, or workflow not found', diff --git a/services/gitlab/gitlab-base.js b/services/gitlab/gitlab-base.js index faa996fd15b6c7b1261a1224fe57110a425703f6..f0c73ed8f5f4e399cea4e6992ba2a2acf61b9ca6 100644 --- a/services/gitlab/gitlab-base.js +++ b/services/gitlab/gitlab-base.js @@ -20,7 +20,7 @@ export default class GitLabBase extends BaseJsonService { async fetchPage({ page, requestParams, schema }) { const { res, buffer } = await this._request({ ...requestParams, - ...{ options: { qs: { page } } }, + ...{ options: { searchParams: { page } } }, }) const json = this._parseJson(buffer) @@ -39,7 +39,7 @@ export default class GitLabBase extends BaseJsonService { url, options: { headers: { Accept: 'application/json' }, - qs: { per_page: 100 }, + searchParams: { per_page: 100 }, ...options, }, errorMessages, diff --git a/services/gitlab/gitlab-release.service.js b/services/gitlab/gitlab-release.service.js index 5c63d211c140565a81aac4529b9c8f003e5a66bb..4a5f8130e5e5de362835027c253c00284d23f771 100644 --- a/services/gitlab/gitlab-release.service.js +++ b/services/gitlab/gitlab-release.service.js @@ -106,7 +106,7 @@ export default class GitLabRelease extends GitLabBase { 404: 'project not found', }, options: { - qs: { order_by: orderBy }, + searchParams: { order_by: orderBy }, }, firstPageOnly: !isSemver, }) diff --git a/services/gitlab/gitlab-tag.service.js b/services/gitlab/gitlab-tag.service.js index 0a732bb4efe88a959d381ca6f9fbde8cec971fb1..570a089916cb3567e03f7a7aee194b2c2a5ca5b7 100644 --- a/services/gitlab/gitlab-tag.service.js +++ b/services/gitlab/gitlab-tag.service.js @@ -95,7 +95,7 @@ export default class GitlabTag extends GitLabBase { url: `${baseUrl}/api/v4/projects/${encodeURIComponent( project )}/repository/tags`, - options: { qs: { order_by: 'updated' } }, + options: { searchParams: { order_by: 'updated' } }, errorMessages: { 404: 'repo not found', }, diff --git a/services/hsts/hsts.service.js b/services/hsts/hsts.service.js index c768815d5639e23aa1da41ccf7a2ef93bb793c01..ddeae98cfc5cac178e24f434a20da97a5707536c 100644 --- a/services/hsts/hsts.service.js +++ b/services/hsts/hsts.service.js @@ -56,7 +56,7 @@ export default class HSTS extends BaseJsonService { return this._requestJson({ schema, url: `https://hstspreload.org/api/v2/status`, - options: { qs: { domain } }, + options: { searchParams: { domain } }, }) } diff --git a/services/jenkins/jenkins-base.js b/services/jenkins/jenkins-base.js index 4579e99773448739ff68db03f4b65a316f073adf..35398c030147537f772a53beadc8a3af5a2b68b8 100644 --- a/services/jenkins/jenkins-base.js +++ b/services/jenkins/jenkins-base.js @@ -10,13 +10,13 @@ export default class JenkinsBase extends BaseJsonService { async fetch({ url, schema, - qs, + searchParams, errorMessages = { 404: 'instance or job not found' }, }) { return this._requestJson( this.authHelper.withBasicAuth({ url, - options: { qs }, + options: { searchParams }, schema, errorMessages, }) diff --git a/services/jenkins/jenkins-build.service.js b/services/jenkins/jenkins-build.service.js index a6cf8c03270679ffb16ade3563a604ff5b46993a..16ed18760308fb2394b6e2e35f5dec829bb4461b 100644 --- a/services/jenkins/jenkins-build.service.js +++ b/services/jenkins/jenkins-build.service.js @@ -72,7 +72,7 @@ export default class JenkinsBuild extends JenkinsBase { const json = await this.fetch({ url: buildUrl({ jobUrl, lastCompletedBuild: false }), schema, - qs: buildTreeParamQueryString('color'), + searchParams: buildTreeParamQueryString('color'), }) const { status } = this.transform({ json }) return this.constructor.render({ status }) diff --git a/services/jenkins/jenkins-coverage.service.js b/services/jenkins/jenkins-coverage.service.js index 6f053650efb42c2307fbffcfdaa787d4dc84a39e..b1c3ffb74e9a5b40519b1ebc26292505fc62ece6 100644 --- a/services/jenkins/jenkins-coverage.service.js +++ b/services/jenkins/jenkins-coverage.service.js @@ -118,7 +118,7 @@ export default class JenkinsCoverage extends JenkinsBase { const json = await this.fetch({ url: buildUrl({ jobUrl, plugin: pluginSpecificPath }), schema, - qs: buildTreeParamQueryString(treeQueryParam), + searchParams: buildTreeParamQueryString(treeQueryParam), errorMessages: { 404: 'job or coverage not found', }, diff --git a/services/jenkins/jenkins-tests.service.js b/services/jenkins/jenkins-tests.service.js index a39d933d282fe87a26be4d4d3c3618a05ae4d005..810cf614bb12c9d6d08322dc644ea7db066761e8 100644 --- a/services/jenkins/jenkins-tests.service.js +++ b/services/jenkins/jenkins-tests.service.js @@ -116,7 +116,9 @@ export default class JenkinsTests extends JenkinsBase { const json = await this.fetch({ url: buildUrl({ jobUrl }), schema, - qs: buildTreeParamQueryString('actions[failCount,skipCount,totalCount]'), + searchParams: buildTreeParamQueryString( + 'actions[failCount,skipCount,totalCount]' + ), }) const { passed, failed, skipped, total } = this.transform({ json }) return this.constructor.render({ diff --git a/services/jira/jira-sprint.service.js b/services/jira/jira-sprint.service.js index 875a85e92cff8180616788b2b80e584d53fc6973..eaf6b0bcc31e4f184531d0e4f976bacb1a2693f9 100644 --- a/services/jira/jira-sprint.service.js +++ b/services/jira/jira-sprint.service.js @@ -86,7 +86,7 @@ export default class JiraSprint extends BaseJsonService { url: `${baseUrl}/rest/api/2/search`, schema, options: { - qs: { + searchParams: { jql: `sprint=${sprintId} AND type IN (Bug,Improvement,Story,"Technical task")`, fields: 'resolution', maxResults: 500, diff --git a/services/keybase/keybase-btc.service.js b/services/keybase/keybase-btc.service.js index f0a3196135daa2c8facb9cd5c4d583d2b85ab7a1..f761169f2186aa823f30705ea68d10fed6d887ea 100644 --- a/services/keybase/keybase-btc.service.js +++ b/services/keybase/keybase-btc.service.js @@ -58,7 +58,7 @@ export default class KeybaseBTC extends KeybaseProfile { async handle({ username }) { const options = { - qs: { + searchParams: { usernames: username, fields: 'cryptocurrency_addresses', }, diff --git a/services/keybase/keybase-pgp.service.js b/services/keybase/keybase-pgp.service.js index 6e049754ecfc93a7fb6ec676e183e6412805bf33..5f585a8d73d10055075c6392cb378fe1bc1fa6b0 100644 --- a/services/keybase/keybase-pgp.service.js +++ b/services/keybase/keybase-pgp.service.js @@ -51,7 +51,7 @@ export default class KeybasePGP extends KeybaseProfile { async handle({ username }) { const options = { - qs: { + searchParams: { usernames: username, fields: 'public_keys', }, diff --git a/services/keybase/keybase-xlm.service.js b/services/keybase/keybase-xlm.service.js index d7005ff6f2c290cc54cf8b1f02bf8385c2211c80..1cde6d6663e6ec8635877270762e06572ef2ad7f 100644 --- a/services/keybase/keybase-xlm.service.js +++ b/services/keybase/keybase-xlm.service.js @@ -56,7 +56,7 @@ export default class KeybaseXLM extends KeybaseProfile { async handle({ username }) { const options = { - qs: { + searchParams: { usernames: username, fields: 'stellar', }, diff --git a/services/keybase/keybase-zec.service.js b/services/keybase/keybase-zec.service.js index 399a61e588b77fab3e869ef6c6a2439a9c35e9c0..8cb57461452aed0cd213643eb1fd1df22b66acd3 100644 --- a/services/keybase/keybase-zec.service.js +++ b/services/keybase/keybase-zec.service.js @@ -58,7 +58,7 @@ export default class KeybaseZEC extends KeybaseProfile { async handle({ username }) { const options = { - qs: { + searchParams: { usernames: username, fields: 'cryptocurrency_addresses', }, diff --git a/services/librariesio/librariesio-api-provider.js b/services/librariesio/librariesio-api-provider.js index 8dd9da64c92c75a4b8ad61ecfbb7cb9e7e4107d4..07e140a767d18f29de3c3e51aaa098cc4bfdc6cc 100644 --- a/services/librariesio/librariesio-api-provider.js +++ b/services/librariesio/librariesio-api-provider.js @@ -89,9 +89,9 @@ export default class LibrariesIoApiProvider { 'User-Agent': userAgent, ...options.headers, }, - qs: { + searchParams: { api_key: tokenString, - ...options.qs, + ...options.searchParams, }, }, } diff --git a/services/localizely/localizely.service.js b/services/localizely/localizely.service.js index 1e8ac606083294ec2e7b0e91ad104eb40d5f445b..47c301453be4085e08795fb56dff7d853c88e905 100644 --- a/services/localizely/localizely.service.js +++ b/services/localizely/localizely.service.js @@ -108,7 +108,7 @@ export default class Localizely extends BaseJsonService { schema, url: `https://api.localizely.com/v1/projects/${projectId}/status`, options: { - qs: { branch }, + searchParams: { branch }, headers: { 'X-Api-Token': apiToken }, }, errorMessages: { diff --git a/services/matrix/matrix.service.js b/services/matrix/matrix.service.js index ca2dca02c5e63631eedd96a0256c8a2f28e91c24..fa02bcbdbb3cec6b81d085870756260f76f79c3b 100644 --- a/services/matrix/matrix.service.js +++ b/services/matrix/matrix.service.js @@ -106,7 +106,7 @@ export default class Matrix extends BaseJsonService { schema: matrixRegisterSchema, options: { method: 'POST', - qs: guest + searchParams: guest ? { kind: 'guest', } @@ -131,7 +131,7 @@ export default class Matrix extends BaseJsonService { )}`, schema: matrixAliasLookupSchema, options: { - qs: { + searchParams: { access_token: accessToken, }, }, @@ -170,7 +170,7 @@ export default class Matrix extends BaseJsonService { )}/state`, schema: matrixStateSchema, options: { - qs: { + searchParams: { access_token: accessToken, }, }, diff --git a/services/mozilla-observatory/mozilla-observatory.service.js b/services/mozilla-observatory/mozilla-observatory.service.js index 8f436056c2d0dfaa9aa6f8ee5de160bf3e7dbf79..4b83a059a35fe6809101712cf774ae1f435b9b5e 100644 --- a/services/mozilla-observatory/mozilla-observatory.service.js +++ b/services/mozilla-observatory/mozilla-observatory.service.js @@ -102,7 +102,7 @@ export default class MozillaObservatory extends BaseJsonService { url: `https://http-observatory.security.mozilla.org/api/v1/analyze`, options: { method: 'POST', - qs: { host }, + searchParams: { host }, form: { hidden: !publish }, }, }) diff --git a/services/nexus/nexus.service.js b/services/nexus/nexus.service.js index 67451ef0c929e528912160f1e818051b01e04e9d..a160fe9ff1dd1cc7e1ff36106956d34c4b8c58a6 100644 --- a/services/nexus/nexus.service.js +++ b/services/nexus/nexus.service.js @@ -162,7 +162,7 @@ export default class Nexus extends BaseJsonService { } } - addQueryParamsToQueryString({ qs, queryOpt }) { + addQueryParamsToQueryString({ searchParams, queryOpt }) { // Users specify query options with 'key=value' pairs, using a // colon delimiter between pairs ([:k1=v1[:k2=v2[...]]]). // queryOpt will be a string containing those key/value pairs, @@ -172,7 +172,7 @@ export default class Nexus extends BaseJsonService { const paramParts = keyValuePair.split('=') const paramKey = paramParts[0] const paramValue = paramParts[1] - qs[paramKey] = paramValue + searchParams[paramKey] = paramValue }) } @@ -194,7 +194,7 @@ export default class Nexus extends BaseJsonService { } async fetch2({ server, repo, groupId, artifactId, queryOpt }) { - const qs = { + const searchParams = { g: groupId, a: artifactId, } @@ -209,19 +209,19 @@ export default class Nexus extends BaseJsonService { } else { schema = nexus2ResolveApiSchema url += 'service/local/artifact/maven/resolve' - qs.r = repo - qs.v = 'LATEST' + searchParams.r = repo + searchParams.v = 'LATEST' } if (queryOpt) { - this.addQueryParamsToQueryString({ qs, queryOpt }) + this.addQueryParamsToQueryString({ searchParams, queryOpt }) } const json = await this._requestJson( this.authHelper.withBasicAuth({ schema, url, - options: { qs }, + options: { searchParams }, errorMessages: { 404: 'artifact not found', }, @@ -232,7 +232,7 @@ export default class Nexus extends BaseJsonService { } async fetch3({ server, repo, groupId, artifactId, queryOpt }) { - const qs = { + const searchParams = { group: groupId, name: artifactId, sort: 'version', @@ -240,18 +240,18 @@ export default class Nexus extends BaseJsonService { switch (repo) { case 's': - qs.prerelease = 'true' + searchParams.prerelease = 'true' break case 'r': - qs.prerelease = 'false' + searchParams.prerelease = 'false' break default: - qs.repository = repo + searchParams.repository = repo break } if (queryOpt) { - this.addQueryParamsToQueryString({ qs, queryOpt }) + this.addQueryParamsToQueryString({ searchParams, queryOpt }) } const url = `${server}${ @@ -262,7 +262,7 @@ export default class Nexus extends BaseJsonService { this.authHelper.withBasicAuth({ schema: nexus3SearchApiSchema, url, - options: { qs }, + options: { searchParams }, errorMessages: { 404: 'artifact not found', }, diff --git a/services/nodeping/nodeping-status.service.js b/services/nodeping/nodeping-status.service.js index 32d145b995fed840f831c6301502d8e9b68038e6..65ead9a6490079a8879a45006b9adb726227e302 100644 --- a/services/nodeping/nodeping-status.service.js +++ b/services/nodeping/nodeping-status.service.js @@ -40,7 +40,7 @@ export default class NodePingStatus extends BaseJsonService { schema, url: `https://nodeping.com/reports/results/${checkUuid}/1`, options: { - qs: { format: 'json' }, + searchParams: { format: 'json' }, headers: { 'cache-control': 'no-cache', }, diff --git a/services/nodeping/nodeping-uptime.service.js b/services/nodeping/nodeping-uptime.service.js index 827ac7b6a826db6a694fd4722acac0c9ed815819..fa1e2d9a63015ac6c7219263e49de97725672e76 100644 --- a/services/nodeping/nodeping-uptime.service.js +++ b/services/nodeping/nodeping-uptime.service.js @@ -61,7 +61,11 @@ export default class NodePingUptime extends BaseJsonService { schema, url: `https://nodeping.com/reports/uptime/${checkUuid}`, options: { - qs: { format: 'json', interval: 'days', start: thirtyDaysAgo }, + searchParams: { + format: 'json', + interval: 'days', + start: thirtyDaysAgo, + }, headers: { 'cache-control': 'no-cache', }, diff --git a/services/nuget/nuget-v2-service-family.js b/services/nuget/nuget-v2-service-family.js index b950a1ed2b6ea9d353ec567b3ed434a4987a4c16..17bfc851ea9dd9c19b940b3cec9979f7d4bc0d48 100644 --- a/services/nuget/nuget-v2-service-family.js +++ b/services/nuget/nuget-v2-service-family.js @@ -58,14 +58,16 @@ async function fetch( { odataFormat, baseUrl, packageName, includePrereleases = false } ) { const url = `${baseUrl}/Packages()` - const qs = { $filter: createFilter({ packageName, includePrereleases }) } + const searchParams = { + $filter: createFilter({ packageName, includePrereleases }), + } let packageData if (odataFormat === 'xml') { const data = await serviceInstance._requestXml({ schema: xmlSchema, url, - options: { qs }, + options: { searchParams }, }) packageData = odataToObject(data.feed.entry) } else if (odataFormat === 'json') { @@ -74,7 +76,7 @@ async function fetch( url, options: { headers: { Accept: 'application/atom+json,application/json' }, - qs, + searchParams, }, }) packageData = data.d.results[0] diff --git a/services/nuget/nuget-v3-service-family.js b/services/nuget/nuget-v3-service-family.js index 3a06cd297e84d039bec6d6a3c54f81dcab45c6ad..ff4f37545c304e16ebfd3e5264c68f69a75bd8a7 100644 --- a/services/nuget/nuget-v3-service-family.js +++ b/services/nuget/nuget-v3-service-family.js @@ -78,7 +78,7 @@ async function fetch( schema, url: await searchServiceUrl(baseUrl, 'SearchQueryService'), options: { - qs: { + searchParams: { q: `packageid:${encodeURIComponent(packageName.toLowerCase())}`, // Include prerelease versions. prerelease: 'true', diff --git a/services/opm/opm-version.service.js b/services/opm/opm-version.service.js index 6d9f41c43880d3decc0bc45670a4b15b2a393ee6..9adc0d179f86e5c64ff1d8b711d1e182b4b69297 100644 --- a/services/opm/opm-version.service.js +++ b/services/opm/opm-version.service.js @@ -29,7 +29,7 @@ export default class OpmVersion extends BaseService { url: `https://opm.openresty.org/api/pkg/fetch`, options: { method: 'HEAD', - qs: { + searchParams: { account: user, name: moduleName, }, diff --git a/services/readthedocs/readthedocs.service.js b/services/readthedocs/readthedocs.service.js index 7522e69c3fc5fda2f0abf87a01456752f53d95b4..9b75e04cec90643fcb70635d6649c5b582ab0d69 100644 --- a/services/readthedocs/readthedocs.service.js +++ b/services/readthedocs/readthedocs.service.js @@ -49,7 +49,7 @@ export default class ReadTheDocs extends BaseSvgScrapingService { url: `https://readthedocs.org/projects/${encodeURIComponent( project )}/badge/`, - options: { qs: { version } }, + options: { searchParams: { version } }, }) if (status === 'unknown') { throw new NotFound({ diff --git a/services/requires/requires.service.js b/services/requires/requires.service.js index e3abdacde8996f8be6dbfb3be9b50d51efa6c3c8..da9cde2af79aaa52cbd78b4157a857e6cacd91cb 100644 --- a/services/requires/requires.service.js +++ b/services/requires/requires.service.js @@ -54,7 +54,7 @@ export default class RequiresIo extends BaseJsonService { return this._requestJson({ url, schema: statusSchema, - options: { qs: { branch } }, + options: { searchParams: { branch } }, }) } diff --git a/services/security-headers/security-headers.service.js b/services/security-headers/security-headers.service.js index 0b935a871eb45f171d406ef45c847fc3115dadba..103108cbfbe91f91ef57bda0caa1c753d44554a0 100644 --- a/services/security-headers/security-headers.service.js +++ b/services/security-headers/security-headers.service.js @@ -75,7 +75,7 @@ export default class SecurityHeaders extends BaseService { url: `https://securityheaders.com`, options: { method: 'HEAD', - qs: { + searchParams: { q: url, hide: 'on', followRedirects: ignoreRedirects !== undefined ? null : 'on', diff --git a/services/snyk/snyk-vulnerability-base.js b/services/snyk/snyk-vulnerability-base.js index 1316490a714453a5a37e2e832280f31f44d6afa7..39a5fd33f9e7ddb9dac4775d785656a45d7804ed 100644 --- a/services/snyk/snyk-vulnerability-base.js +++ b/services/snyk/snyk-vulnerability-base.js @@ -25,12 +25,12 @@ export default class SnykVulnerabilityBase extends BaseSvgScrapingService { } } - async fetch({ url, qs, errorMessages }) { + async fetch({ url, searchParams, errorMessages }) { const { message: vulnerabilities } = await this._requestSvg({ url, schema, options: { - qs, + searchParams, }, errorMessages, }) diff --git a/services/snyk/snyk-vulnerability-github.service.js b/services/snyk/snyk-vulnerability-github.service.js index fd187e7fbebce9aa67eec1deff37bdf74576c4f8..43c9dd31bb81390597fbeddbbf8ee9d3e1b4d0c7 100644 --- a/services/snyk/snyk-vulnerability-github.service.js +++ b/services/snyk/snyk-vulnerability-github.service.js @@ -36,10 +36,10 @@ export default class SnykVulnerabilityGitHub extends SynkVulnerabilityBase { async handle({ user, repo, manifestFilePath }) { const url = `https://snyk.io/test/github/${user}/${repo}/badge.svg` - const qs = { targetFile: manifestFilePath } + const searchParams = { targetFile: manifestFilePath } const { vulnerabilities } = await this.fetch({ url, - qs, + searchParams, errorMessages: { 404: 'repo or manifest not found', }, diff --git a/services/sonar/sonar-base.js b/services/sonar/sonar-base.js index 86d86df1273ca7ee08f126b41f036833d0632f3a..2e4fd807ca20f43c69a9f90c9bc4b54bdd0ed644 100644 --- a/services/sonar/sonar-base.js +++ b/services/sonar/sonar-base.js @@ -55,11 +55,11 @@ export default class SonarBase extends BaseJsonService { async fetch({ sonarVersion, server, component, metricName, branch }) { const useLegacyApi = isLegacyVersion({ sonarVersion }) - let qs, url, schema + let searchParams, url, schema if (useLegacyApi) { schema = legacySchema url = `${server}/api/resources` - qs = { + searchParams = { resource: component, depth: 0, metrics: metricName, @@ -72,7 +72,7 @@ export default class SonarBase extends BaseJsonService { // componentKey query param was renamed in version 6.6 const componentKey = parseFloat(sonarVersion) >= 6.6 ? 'component' : 'componentKey' - qs = { + searchParams = { [componentKey]: component, metricKeys: metricName, branch, @@ -83,7 +83,7 @@ export default class SonarBase extends BaseJsonService { this.authHelper.withBasicAuth({ schema, url, - options: { qs }, + options: { searchParams }, errorMessages: { 404: 'component or metric not found, or legacy API not supported', }, diff --git a/services/sourceforge/sourceforge.service.js b/services/sourceforge/sourceforge.service.js index 6880bbf09fbc6249957e9abfc2ef409c41621b3f..a6feca914ca541e0518c64def1b6f4ed40caafeb 100644 --- a/services/sourceforge/sourceforge.service.js +++ b/services/sourceforge/sourceforge.service.js @@ -81,7 +81,7 @@ export default class Sourceforge extends BaseJsonService { const endDate = moment().subtract(24, 'hours') const startDate = intervalMap[interval].startDate(endDate) const options = { - qs: { + searchParams: { start_date: startDate.format('YYYY-MM-DD'), end_date: endDate.format('YYYY-MM-DD'), }, diff --git a/services/stackexchange/stackexchange-monthlyquestions.service.js b/services/stackexchange/stackexchange-monthlyquestions.service.js index ff0143c63ddbc8f6af0a7a67e22e5fa1f90d468c..1e74ff34809e8d36dabc5dfec017e56a0006e80c 100644 --- a/services/stackexchange/stackexchange-monthlyquestions.service.js +++ b/services/stackexchange/stackexchange-monthlyquestions.service.js @@ -54,8 +54,8 @@ export default class StackExchangeMonthlyQuestions extends BaseJsonService { const parsedData = await this._requestJson({ schema: tagSchema, options: { - gzip: true, - qs: { + decompress: true, + searchParams: { site: stackexchangesite, fromdate: prevMonthStart, todate: prevMonthEnd, diff --git a/services/stackexchange/stackexchange-reputation.service.js b/services/stackexchange/stackexchange-reputation.service.js index ea8b7b36bbac2181aa6281d40561483b5c3ca1da..adda5b0cc632aaaf1c01feb0fdc4e8db443c7b6f 100644 --- a/services/stackexchange/stackexchange-reputation.service.js +++ b/services/stackexchange/stackexchange-reputation.service.js @@ -53,7 +53,7 @@ export default class StackExchangeReputation extends BaseJsonService { const parsedData = await this._requestJson({ schema: reputationSchema, - options: { gzip: true, qs: { site: stackexchangesite } }, + options: { decompress: true, searchParams: { site: stackexchangesite } }, url: `https://api.stackexchange.com/2.2/${path}`, errorMessages: { 400: 'invalid parameters', diff --git a/services/stackexchange/stackexchange-taginfo.service.js b/services/stackexchange/stackexchange-taginfo.service.js index af3d5d2557e46c0e44bad263dce7278737749b4d..60a202d8fa36ce492283a93f65b11f275aa8d1dd 100644 --- a/services/stackexchange/stackexchange-taginfo.service.js +++ b/services/stackexchange/stackexchange-taginfo.service.js @@ -50,7 +50,7 @@ export default class StackExchangeQuestions extends BaseJsonService { const parsedData = await this._requestJson({ schema: tagSchema, - options: { gzip: true, qs: { site: stackexchangesite } }, + options: { decompress: true, searchParams: { site: stackexchangesite } }, url: `https://api.stackexchange.com/2.2/${path}`, }) diff --git a/services/swagger/swagger.service.js b/services/swagger/swagger.service.js index be4127345553bd9b6c15c97b63f5d857180739fe..0c24efd9b4821bffb71640903d39324b180ce654 100644 --- a/services/swagger/swagger.service.js +++ b/services/swagger/swagger.service.js @@ -55,7 +55,7 @@ export default class SwaggerValidatorService extends BaseJsonService { url: 'http://validator.swagger.io/validator/debug', schema, options: { - qs: { + searchParams: { url: specUrl, }, }, diff --git a/services/teamcity/teamcity-base.js b/services/teamcity/teamcity-base.js index 1e811a7aef5c6bc37b1a648b082d05d565a8596b..a3b447c72dc6b888e7d62118faaccec310d1444d 100644 --- a/services/teamcity/teamcity-base.js +++ b/services/teamcity/teamcity-base.js @@ -7,11 +7,11 @@ export default class TeamCityBase extends BaseJsonService { serviceKey: 'teamcity', } - async fetch({ url, schema, qs = {}, errorMessages = {} }) { + async fetch({ url, schema, searchParams = {}, errorMessages = {} }) { // JetBrains API Auth Docs: https://confluence.jetbrains.com/display/TCD18/REST+API#RESTAPI-RESTAuthentication - const options = { qs } + const options = { searchParams } if (!this.authHelper.isConfigured) { - qs.guest = 1 + searchParams.guest = 1 } return this._requestJson( diff --git a/services/travis/travis-build.service.js b/services/travis/travis-build.service.js index 2c52799588a4ca1d7049ef6b872b1e4d7eb7ff54..c597958e2c8fa98765f69efbdc43747fdb736c1c 100644 --- a/services/travis/travis-build.service.js +++ b/services/travis/travis-build.service.js @@ -78,7 +78,7 @@ export default class TravisBuild extends BaseSvgScrapingService { const { message: status } = await this._requestSvg({ schema, url: `https://api.travis-ci.${domain}/${userRepo}.svg`, - options: { qs: { branch } }, + options: { searchParams: { branch } }, valueMatcher: />([^<>]+)<\/text><\/g>/, }) diff --git a/services/treeware/treeware-trees.service.js b/services/treeware/treeware-trees.service.js index 1fcbc10125cfb3875367ae0d67e00bcbf2712922..e0b32e217f360c307242a3243ec27b8734c7fc5c 100644 --- a/services/treeware/treeware-trees.service.js +++ b/services/treeware/treeware-trees.service.js @@ -38,7 +38,7 @@ export default class TreewareTrees extends BaseJsonService { url, schema: apiSchema, options: { - qs: { ref: reference }, + searchParams: { ref: reference }, }, }) } diff --git a/services/twitch/twitch-base.js b/services/twitch/twitch-base.js index 85d4e6b08303f5c2dd72c32dc9315ab29b1f9308..de34e6fa7b521e00a8e5294e8f5de7cf82198ad3 100644 --- a/services/twitch/twitch-base.js +++ b/services/twitch/twitch-base.js @@ -42,7 +42,7 @@ export default class TwitchBase extends BaseJsonService { url: `https://id.twitch.tv/oauth2/token`, options: { method: 'POST', - qs: { + searchParams: { grant_type: 'client_credentials', }, }, diff --git a/services/twitch/twitch-extension-version.service.js b/services/twitch/twitch-extension-version.service.js index ff4d2295e22e271fc9bf6186a6e5c184db080fac..a8393d4854d4928366a63423c66ee354b2ad4b0c 100644 --- a/services/twitch/twitch-extension-version.service.js +++ b/services/twitch/twitch-extension-version.service.js @@ -36,7 +36,7 @@ export default class TwitchExtensionVersion extends TwitchBase { schema: helixSchema, url: `https://api.twitch.tv/helix/extensions/released`, options: { - qs: { extension_id: extensionId }, + searchParams: { extension_id: extensionId }, }, }) diff --git a/services/twitch/twitch.service.js b/services/twitch/twitch.service.js index 402f7e52cc4590c7ebe9b21c84749f4b0849f788..359d19de5e4c77d5ee52be3154aeeb4333c43bd4 100644 --- a/services/twitch/twitch.service.js +++ b/services/twitch/twitch.service.js @@ -53,7 +53,7 @@ export default class TwitchStatus extends TwitchBase { schema: helixSchema, url: `https://api.twitch.tv/helix/streams`, options: { - qs: { user_login: user }, + searchParams: { user_login: user }, }, }) diff --git a/services/twitter/twitter.service.js b/services/twitter/twitter.service.js index 2da76486a0846fec9912a25e3d549d8d85d1c189..81086e240827d5469c7618939e440b56d777e63d 100644 --- a/services/twitter/twitter.service.js +++ b/services/twitter/twitter.service.js @@ -100,7 +100,7 @@ class TwitterFollow extends BaseJsonService { return this._requestJson({ schema, url: `http://cdn.syndication.twimg.com/widgets/followbutton/info.json`, - options: { qs: { screen_names: user } }, + options: { searchParams: { screen_names: user } }, }) } diff --git a/services/ubuntu/ubuntu.service.js b/services/ubuntu/ubuntu.service.js index c584c95503edc9f3fd8de525339dc55c2066064a..a52d61b14b6efb198e7c9d0f1720ff3cfa458c00 100644 --- a/services/ubuntu/ubuntu.service.js +++ b/services/ubuntu/ubuntu.service.js @@ -44,7 +44,7 @@ export default class Ubuntu extends BaseJsonService { schema, url: 'https://api.launchpad.net/1.0/ubuntu/+archive/primary', options: { - qs: { + searchParams: { 'ws.op': 'getPublishedSources', exact_match: 'true', order_by_date: 'true', diff --git a/services/vaadin-directory/vaadin-directory-base.js b/services/vaadin-directory/vaadin-directory-base.js index b567df2b3177e0714a4de80961fa3013e419de64..04f702b02a24c7427688018cecdb189f36a9e766 100644 --- a/services/vaadin-directory/vaadin-directory-base.js +++ b/services/vaadin-directory/vaadin-directory-base.js @@ -18,7 +18,7 @@ class BaseVaadinDirectoryService extends BaseJsonService { schema, url: `https://vaadin.com/vaadincom/directory-service/components/search/findByUrlIdentifier`, options: { - qs: { + searchParams: { projection: 'summary', urlIdentifier: packageName, }, diff --git a/services/w3c/w3c-validation.service.js b/services/w3c/w3c-validation.service.js index 945fd9a27473c9647c05f829522157fa504f0145..070b5cf3454dce21b99e3661aae6f738567a8316 100644 --- a/services/w3c/w3c-validation.service.js +++ b/services/w3c/w3c-validation.service.js @@ -67,7 +67,7 @@ export default class W3cValidation extends BaseJsonService { url: 'https://validator.nu/', schema, options: { - qs: { + searchParams: { schema: getSchema(preset), parser: parser === 'default' ? undefined : parser, doc: encodeURI(targetUrl), diff --git a/services/wercker/wercker.service.js b/services/wercker/wercker.service.js index 286c24f21a67036671da426b9c37b088cd858bf5..263cd542e4a469a5707cbe0a31fd5d805791c8d6 100644 --- a/services/wercker/wercker.service.js +++ b/services/wercker/wercker.service.js @@ -93,19 +93,19 @@ export default class Wercker extends BaseJsonService { async fetch({ projectId, applicationName, branch }) { let url - const qs = { branch, limit: 1 } + const searchParams = { branch, limit: 1 } if (applicationName) { url = `https://app.wercker.com/api/v3/applications/${applicationName}/builds` } else { url = 'https://app.wercker.com/api/v3/runs' - qs.applicationId = projectId + searchParams.applicationId = projectId } return this._requestJson({ schema: werckerSchema, url, - options: { qs }, + options: { searchParams }, errorMessages: { 401: 'private application not supported', 404: 'application not found', diff --git a/services/wikiapiary/wikiapiary-installs.service.js b/services/wikiapiary/wikiapiary-installs.service.js index 197910829d7194a514bb1e098d4a5539ac16ea17..6b11ed156713a421436e651f005fd52563b9a880 100644 --- a/services/wikiapiary/wikiapiary-installs.service.js +++ b/services/wikiapiary/wikiapiary-installs.service.js @@ -77,7 +77,7 @@ export default class WikiapiaryInstalls extends BaseJsonService { schema, url: `https://wikiapiary.com/w/api.php`, options: { - qs: { + searchParams: { action: 'ask', query: `[[${variant}:${name}]]|?Has_website_count`, format: 'json', diff --git a/services/wordpress/wordpress-base.js b/services/wordpress/wordpress-base.js index 7f660e72624add4ee828f053ea9b2b92114ab40b..365e70625fdca2bc51a20aca265ae1e0db7177da 100644 --- a/services/wordpress/wordpress-base.js +++ b/services/wordpress/wordpress-base.js @@ -75,7 +75,7 @@ export default class BaseWordpress extends BaseJsonService { url, schema: schemas, options: { - qs: queryString, + searchParams: queryString, }, }) if ('error' in json) { diff --git a/services/wordpress/wordpress-downloads.service.js b/services/wordpress/wordpress-downloads.service.js index 538ae6754e948cff57f22c9b54656c80ff71f3a6..4a9585e250c1e6e83bd82eaf7ceeb4836944a9aa 100644 --- a/services/wordpress/wordpress-downloads.service.js +++ b/services/wordpress/wordpress-downloads.service.js @@ -85,7 +85,7 @@ function DownloadsForExtensionType(extensionType) { schema: dateSchema, url: `https://api.wordpress.org/stats/${extType}/1.0/downloads.php`, options: { - qs: { + searchParams: { slug, limit, }, diff --git a/services/youtube/youtube-base.js b/services/youtube/youtube-base.js index 94f14ee6018d2ca33bde18934d4c312d8109dd9d..cd2552802a18de933dee2c66d74c92b5d679fb1c 100644 --- a/services/youtube/youtube-base.js +++ b/services/youtube/youtube-base.js @@ -62,7 +62,7 @@ class YouTubeBase extends BaseJsonService { schema, url: `https://www.googleapis.com/youtube/v3/${this.constructor.type}s`, options: { - qs: { id, part: 'statistics' }, + searchParams: { id, part: 'statistics' }, }, } )