openapi-client-axios
Advanced tools
Comparing version 5.3.0 to 5.3.1
@@ -44,2 +44,3 @@ import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; | ||
private baseURLVariables; | ||
private applyMethodCommonHeaders; | ||
private transformOperationName; | ||
@@ -54,2 +55,3 @@ private transformOperationMethod; | ||
* @param {boolean} opts.quick - quick mode, skips validation and doesn't guarantee document is unchanged | ||
* @param {boolean} opts.applyMethodCommonHeaders Should method (patch / post / put / etc.) specific default headers (from axios.defaults.headers.{method}) be applied to operation methods? | ||
* @param {boolean} opts.axiosConfigDefaults - default axios config for the instance | ||
@@ -67,2 +69,3 @@ * @memberof OpenAPIClientAxios | ||
}; | ||
applyMethodCommonHeaders?: boolean; | ||
transformOperationName?: (operation: string) => string; | ||
@@ -69,0 +72,0 @@ transformOperationMethod?: (operationMethod: UnknownOperationMethod, operationToTransform: Operation) => UnknownOperationMethod; |
@@ -111,2 +111,3 @@ "use strict"; | ||
* @param {boolean} opts.quick - quick mode, skips validation and doesn't guarantee document is unchanged | ||
* @param {boolean} opts.applyMethodCommonHeaders Should method (patch / post / put / etc.) specific default headers (from axios.defaults.headers.{method}) be applied to operation methods? | ||
* @param {boolean} opts.axiosConfigDefaults - default axios config for the instance | ||
@@ -543,15 +544,17 @@ * @memberof OpenAPIClientAxios | ||
// add method specific default headers | ||
var methodHeaders = (_f = defaultHeaders[operation.method]) !== null && _f !== void 0 ? _f : {}; | ||
try { | ||
for (var _o = __values(Object.entries(methodHeaders)), _p = _o.next(); !_p.done; _p = _o.next()) { | ||
var _q = __read(_p.value, 2), key = _q[0], val = _q[1]; | ||
headers[key] = val; | ||
} | ||
} | ||
catch (e_7_1) { e_7 = { error: e_7_1 }; } | ||
finally { | ||
if (_this.applyMethodCommonHeaders) { | ||
var methodHeaders = (_f = defaultHeaders[operation.method]) !== null && _f !== void 0 ? _f : {}; | ||
try { | ||
if (_p && !_p.done && (_d = _o.return)) _d.call(_o); | ||
for (var _o = __values(Object.entries(methodHeaders)), _p = _o.next(); !_p.done; _p = _o.next()) { | ||
var _q = __read(_p.value, 2), key = _q[0], val = _q[1]; | ||
headers[key] = val; | ||
} | ||
} | ||
finally { if (e_7) throw e_7.error; } | ||
catch (e_7_1) { e_7 = { error: e_7_1 }; } | ||
finally { | ||
try { | ||
if (_p && !_p.done && (_d = _o.return)) _d.call(_o); | ||
} | ||
finally { if (e_7) throw e_7.error; } | ||
} | ||
} | ||
@@ -638,3 +641,3 @@ // construct request config | ||
}; | ||
var optsWithDefaults = __assign(__assign({ quick: false, withServer: 0, baseURLVariables: {}, swaggerParserOpts: {}, transformOperationName: function (operationId) { return operationId; }, transformOperationMethod: function (operationMethod) { return operationMethod; }, axiosRunner: function (axiosConfig) { return _this.client.request(axiosConfig); } }, opts), { axiosConfigDefaults: __assign({ paramsSerializer: function (params) { return new URLSearchParams(params).toString(); } }, (opts.axiosConfigDefaults || {})) }); | ||
var optsWithDefaults = __assign(__assign({ quick: false, withServer: 0, baseURLVariables: {}, swaggerParserOpts: {}, transformOperationName: function (operationId) { return operationId; }, transformOperationMethod: function (operationMethod) { return operationMethod; }, axiosRunner: function (axiosConfig) { return _this.client.request(axiosConfig); }, applyMethodCommonHeaders: false }, opts), { axiosConfigDefaults: __assign({ paramsSerializer: function (params) { return new URLSearchParams(params).toString(); } }, (opts.axiosConfigDefaults || {})) }); | ||
this.inputDocument = optsWithDefaults.definition; | ||
@@ -646,2 +649,3 @@ this.quick = optsWithDefaults.quick; | ||
this.baseURLVariables = optsWithDefaults.baseURLVariables; | ||
this.applyMethodCommonHeaders = optsWithDefaults.applyMethodCommonHeaders; | ||
this.transformOperationName = optsWithDefaults.transformOperationName; | ||
@@ -648,0 +652,0 @@ this.transformOperationMethod = optsWithDefaults.transformOperationMethod; |
{ | ||
"name": "openapi-client-axios", | ||
"description": "JavaScript client library for consuming OpenAPI-enabled APIs with axios. Types included.", | ||
"version": "5.3.0", | ||
"version": "5.3.1", | ||
"author": "Viljami Kuosmanen <viljami@viljami.io>", | ||
@@ -74,3 +74,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "1d58827eaaab7db89adeb16dc98e356ee6e2841f" | ||
"gitHead": "cf0d17ae5473a3a035593ea2755353250c9b2054" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70680
1014