Skip to content

Commit

Permalink
Merge pull request #40 from hashicorp-forge/dependabot/npm_and_yarn/a…
Browse files Browse the repository at this point in the history
…xios-1.5.1

Bump axios from 1.5.0 to 1.5.1
  • Loading branch information
brandonc authored Oct 2, 2023
2 parents b87c003 + 2e41c6a commit 64a5a70
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 71 deletions.
65 changes: 44 additions & 21 deletions dist/apply/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7823,7 +7823,7 @@ const defaults = {

transitional: defaults_transitional,

adapter: node.isNode ? 'http' : 'xhr',
adapter: ['xhr', 'http'],

transformRequest: [function transformRequest(data, headers) {
const contentType = headers.getContentType() || '';
Expand Down Expand Up @@ -8464,7 +8464,7 @@ var follow_redirects = __nccwpck_require__(7707);
;// CONCATENATED MODULE: external "zlib"
const external_zlib_namespaceObject = require("zlib");
;// CONCATENATED MODULE: ./node_modules/axios/lib/env/data.js
const VERSION = "1.5.0";
const VERSION = "1.5.1";
;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/parseProtocol.js


Expand Down Expand Up @@ -9469,7 +9469,7 @@ const wrapAsync = (asyncExecutor) => {
delete res.headers['content-encoding'];
}

switch (res.headers['content-encoding']) {
switch ((res.headers['content-encoding'] || '').toLowerCase()) {
/*eslint default-case:0*/
case 'gzip':
case 'x-gzip':
Expand Down Expand Up @@ -9602,7 +9602,7 @@ const wrapAsync = (asyncExecutor) => {
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
const timeout = parseInt(config.timeout, 10);

if (isNaN(timeout)) {
if (Number.isNaN(timeout)) {
reject(new core_AxiosError(
'error trying to parse `config.timeout` to int',
core_AxiosError.ERR_BAD_OPTION_VALUE,
Expand Down Expand Up @@ -9852,11 +9852,16 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
}
}

let contentType;

if (utils.isFormData(requestData)) {
if (node.isStandardBrowserEnv || node.isStandardBrowserWebWorkerEnv) {
requestHeaders.setContentType(false); // Let the browser set it
} else {
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
} else if(utils.isString(contentType = requestHeaders.getContentType())){
// fix semicolon duplication issue for ReactNative FormData implementation
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'))
}
}

Expand Down Expand Up @@ -10055,7 +10060,7 @@ const knownAdapters = {
}

utils.forEach(knownAdapters, (fn, value) => {
if(fn) {
if (fn) {
try {
Object.defineProperty(fn, 'name', {value});
} catch (e) {
Expand All @@ -10065,6 +10070,10 @@ utils.forEach(knownAdapters, (fn, value) => {
}
});

const renderReason = (reason) => `- ${reason}`;

const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;

/* harmony default export */ const adapters = ({
getAdapter: (adapters) => {
adapters = utils.isArray(adapters) ? adapters : [adapters];
Expand All @@ -10073,30 +10082,44 @@ utils.forEach(knownAdapters, (fn, value) => {
let nameOrAdapter;
let adapter;

const rejectedReasons = {};

for (let i = 0; i < length; i++) {
nameOrAdapter = adapters[i];
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
let id;

adapter = nameOrAdapter;

if (!isResolvedHandle(nameOrAdapter)) {
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];

if (adapter === undefined) {
throw new core_AxiosError(`Unknown adapter '${id}'`);
}
}

if (adapter) {
break;
}

rejectedReasons[id || '#' + i] = adapter;
}

if (!adapter) {
if (adapter === false) {
throw new core_AxiosError(
`Adapter ${nameOrAdapter} is not supported by the environment`,
'ERR_NOT_SUPPORT'

const reasons = Object.entries(rejectedReasons)
.map(([id, state]) => `adapter ${id} ` +
(state === false ? 'is not supported by the environment' : 'is not available in the build')
);
}

throw new Error(
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
`Adapter '${nameOrAdapter}' is not available in the build` :
`Unknown adapter '${nameOrAdapter}'`
);
}
let s = length ?
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
'as no adapter specified';

if (!utils.isFunction(adapter)) {
throw new TypeError('adapter is not a function');
throw new core_AxiosError(
`There is no suitable adapter to dispatch the request ` + s,
'ERR_NOT_SUPPORT'
);
}

return adapter;
Expand Down
65 changes: 44 additions & 21 deletions dist/destroy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7823,7 +7823,7 @@ const defaults = {

transitional: defaults_transitional,

adapter: node.isNode ? 'http' : 'xhr',
adapter: ['xhr', 'http'],

transformRequest: [function transformRequest(data, headers) {
const contentType = headers.getContentType() || '';
Expand Down Expand Up @@ -8464,7 +8464,7 @@ var follow_redirects = __nccwpck_require__(7707);
;// CONCATENATED MODULE: external "zlib"
const external_zlib_namespaceObject = require("zlib");
;// CONCATENATED MODULE: ./node_modules/axios/lib/env/data.js
const VERSION = "1.5.0";
const VERSION = "1.5.1";
;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/parseProtocol.js


Expand Down Expand Up @@ -9469,7 +9469,7 @@ const wrapAsync = (asyncExecutor) => {
delete res.headers['content-encoding'];
}

switch (res.headers['content-encoding']) {
switch ((res.headers['content-encoding'] || '').toLowerCase()) {
/*eslint default-case:0*/
case 'gzip':
case 'x-gzip':
Expand Down Expand Up @@ -9602,7 +9602,7 @@ const wrapAsync = (asyncExecutor) => {
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
const timeout = parseInt(config.timeout, 10);

if (isNaN(timeout)) {
if (Number.isNaN(timeout)) {
reject(new core_AxiosError(
'error trying to parse `config.timeout` to int',
core_AxiosError.ERR_BAD_OPTION_VALUE,
Expand Down Expand Up @@ -9852,11 +9852,16 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
}
}

let contentType;

if (utils.isFormData(requestData)) {
if (node.isStandardBrowserEnv || node.isStandardBrowserWebWorkerEnv) {
requestHeaders.setContentType(false); // Let the browser set it
} else {
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
} else if(utils.isString(contentType = requestHeaders.getContentType())){
// fix semicolon duplication issue for ReactNative FormData implementation
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'))
}
}

Expand Down Expand Up @@ -10055,7 +10060,7 @@ const knownAdapters = {
}

utils.forEach(knownAdapters, (fn, value) => {
if(fn) {
if (fn) {
try {
Object.defineProperty(fn, 'name', {value});
} catch (e) {
Expand All @@ -10065,6 +10070,10 @@ utils.forEach(knownAdapters, (fn, value) => {
}
});

const renderReason = (reason) => `- ${reason}`;

const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;

/* harmony default export */ const adapters = ({
getAdapter: (adapters) => {
adapters = utils.isArray(adapters) ? adapters : [adapters];
Expand All @@ -10073,30 +10082,44 @@ utils.forEach(knownAdapters, (fn, value) => {
let nameOrAdapter;
let adapter;

const rejectedReasons = {};

for (let i = 0; i < length; i++) {
nameOrAdapter = adapters[i];
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
let id;

adapter = nameOrAdapter;

if (!isResolvedHandle(nameOrAdapter)) {
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];

if (adapter === undefined) {
throw new core_AxiosError(`Unknown adapter '${id}'`);
}
}

if (adapter) {
break;
}

rejectedReasons[id || '#' + i] = adapter;
}

if (!adapter) {
if (adapter === false) {
throw new core_AxiosError(
`Adapter ${nameOrAdapter} is not supported by the environment`,
'ERR_NOT_SUPPORT'

const reasons = Object.entries(rejectedReasons)
.map(([id, state]) => `adapter ${id} ` +
(state === false ? 'is not supported by the environment' : 'is not available in the build')
);
}

throw new Error(
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
`Adapter '${nameOrAdapter}' is not available in the build` :
`Unknown adapter '${nameOrAdapter}'`
);
}
let s = length ?
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
'as no adapter specified';

if (!utils.isFunction(adapter)) {
throw new TypeError('adapter is not a function');
throw new core_AxiosError(
`There is no suitable adapter to dispatch the request ` + s,
'ERR_NOT_SUPPORT'
);
}

return adapter;
Expand Down
Loading

0 comments on commit 64a5a70

Please sign in to comment.