chore(deps): bump got from 11.8.3 to 12.0.1 (#7370)

* chore(deps): bump got from 11.8.3 to 12.0.1
* update limit syntax
* update CancelError import
* update timeout syntax
* set missing user/pass to empty string for basic auth
* fix opm badge

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <chris.shaw480@gmail.com>
Co-authored-by: chris48s <chris48s@users.noreply.github.com>
This commit is contained in:
dependabot[bot]
2022-01-29 20:04:11 +00:00
committed by GitHub
parent a682ff400a
commit 0f288a42fc
9 changed files with 848 additions and 114 deletions

View File

@@ -108,7 +108,9 @@ class AuthHelper {
get _basicAuth() { get _basicAuth() {
const { _user: username, _pass: password } = this const { _user: username, _pass: password } = this
return this.isConfigured ? { username, password } : undefined return this.isConfigured
? { username: username || '', password: password || '' }
: undefined
} }
/* /*

View File

@@ -107,10 +107,10 @@ describe('AuthHelper', function () {
]).expect({ username: 'admin', password: 'abc123' }) ]).expect({ username: 'admin', password: 'abc123' })
given({ userKey: 'myci_user' }, { myci_user: 'admin' }).expect({ given({ userKey: 'myci_user' }, { myci_user: 'admin' }).expect({
username: 'admin', username: 'admin',
password: undefined, password: '',
}) })
given({ passKey: 'myci_pass' }, { myci_pass: 'abc123' }).expect({ given({ passKey: 'myci_pass' }, { myci_pass: 'abc123' }).expect({
username: undefined, username: '',
password: 'abc123', password: 'abc123',
}) })
given({ userKey: 'myci_user', passKey: 'myci_pass' }, {}).expect( given({ userKey: 'myci_user', passKey: 'myci_pass' }, {}).expect(

View File

@@ -1,4 +1,4 @@
import got from 'got' import got, { CancelError } from 'got'
import { Inaccessible, InvalidResponse } from './errors.js' import { Inaccessible, InvalidResponse } from './errors.js'
import { import {
fetchLimitBytes as fetchLimitBytesDefault, fetchLimitBytes as fetchLimitBytesDefault,
@@ -10,14 +10,14 @@ const userAgent = getUserAgent()
async function sendRequest(gotWrapper, url, options) { async function sendRequest(gotWrapper, url, options) {
const gotOptions = Object.assign({}, options) const gotOptions = Object.assign({}, options)
gotOptions.throwHttpErrors = false gotOptions.throwHttpErrors = false
gotOptions.retry = 0 gotOptions.retry = { limit: 0 }
gotOptions.headers = gotOptions.headers || {} gotOptions.headers = gotOptions.headers || {}
gotOptions.headers['User-Agent'] = userAgent gotOptions.headers['User-Agent'] = userAgent
try { try {
const resp = await gotWrapper(url, gotOptions) const resp = await gotWrapper(url, gotOptions)
return { res: resp, buffer: resp.body } return { res: resp, buffer: resp.body }
} catch (err) { } catch (err) {
if (err instanceof got.CancelError) { if (err instanceof CancelError) {
throw new InvalidResponse({ throw new InvalidResponse({
underlyingError: new Error('Maximum response size exceeded'), underlyingError: new Error('Maximum response size exceeded'),
}) })

View File

@@ -1,4 +1,4 @@
import got from 'got' import got from 'got'
// https://github.com/nock/nock/issues/1523 // https://github.com/nock/nock/issues/1523
export default got.extend({ retry: 0 }) export default got.extend({ retry: { limit: 0 } })

View File

@@ -16,7 +16,7 @@ export default class InfluxMetrics {
url: this._config.url, url: this._config.url,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: await this.metrics(), body: await this.metrics(),
timeout: this._config.timeoutMillseconds, timeout: { request: this._config.timeoutMillseconds },
username: this._config.username, username: this._config.username,
password: this._config.password, password: this._config.password,
throwHttpErrors: false, throwHttpErrors: false,

View File

@@ -5,6 +5,7 @@ import { expect } from 'chai'
import log from './log.js' import log from './log.js'
import InfluxMetrics from './influx-metrics.js' import InfluxMetrics from './influx-metrics.js'
import '../register-chai-plugins.spec.js' import '../register-chai-plugins.spec.js'
describe('Influx metrics', function () { describe('Influx metrics', function () {
const metricInstance = { const metricInstance = {
metrics() { metrics() {

939
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -39,7 +39,7 @@
"fast-xml-parser": "^3.21.1", "fast-xml-parser": "^3.21.1",
"glob": "^7.2.0", "glob": "^7.2.0",
"global-agent": "^3.0.0", "global-agent": "^3.0.0",
"got": "11.8.3", "got": "^12.0.1",
"graphql": "^15.6.1", "graphql": "^15.6.1",
"graphql-tag": "^2.12.6", "graphql-tag": "^2.12.6",
"ioredis": "4.28.3", "ioredis": "4.28.3",

View File

@@ -40,7 +40,7 @@ export default class OpmVersion extends BaseService {
}) })
// TODO: set followRedirect to false and intercept 302 redirects // TODO: set followRedirect to false and intercept 302 redirects
const location = res.request.redirects[0] const location = res.redirectUrls[0].toString()
if (!location) { if (!location) {
throw new NotFound({ prettyMessage: 'module not found' }) throw new NotFound({ prettyMessage: 'module not found' })
} }