fix: 🐛 Added ability to override basePath while creating ApiClient instance (#10327)

Solves #9179
This commit is contained in:
Himanshu Pant 2021-09-23 11:53:56 +05:30 committed by GitHub
parent 31342580cb
commit 538f12c36d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,13 +16,18 @@ import querystring from "querystring";
* @class
*/{{/emitJSDoc}}
class ApiClient {
constructor() {
/**
* The base URL against which to resolve every API call's (relative) path.
* Overrides the default value set in spec file if present
* @param {String} basePath
*/
constructor(basePath = '{{{basePath}}}') {
{{#emitJSDoc}}/**
* The base URL against which to resolve every API call's (relative) path.
* @type {String}
* @default {{{basePath}}}
*/{{/emitJSDoc}}
this.basePath = '{{{basePath}}}'.replace(/\/+$/, '');
this.basePath = basePath.replace(/\/+$/, '');
{{#emitJSDoc}}/**
* The authentication methods to be included for all API calls.