forked from loafle/openapi-generator-original
[JavaScript] Added plugins variable for the javascript/ES6 client (#1797)
* Added plugins variable for the javascript/ES6 client * Ran the javascript and javascript-es6 shell script
This commit is contained in:
@@ -89,6 +89,11 @@ class ApiClient {
|
||||
*/
|
||||
this.requestAgent = null;
|
||||
|
||||
/*
|
||||
* Allow user to add superagent plugins
|
||||
*/
|
||||
this.plugins = null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -354,6 +359,14 @@ class ApiClient {
|
||||
var url = this.buildUrl(path, pathParams);
|
||||
var request = superagent(httpMethod, url);
|
||||
|
||||
if (this.plugins !== null) {
|
||||
for (var index in this.plugins) {
|
||||
if (this.plugins.hasOwnProperty(index)) {
|
||||
request.use(this.plugins[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// apply authentications
|
||||
this.applyAuthToRequest(request, authNames);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user