mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-12 07:50:34 +03:00
parent
defef011eb
commit
a5c03abbe4
|
@ -67,7 +67,7 @@ export class SpecManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
let host = this._schema.host || urlParts.host;
|
let host = this._schema.host || urlParts.host;
|
||||||
this.basePath = this._schema.basePath || '/';
|
this.basePath = this._schema.basePath || '';
|
||||||
this.apiUrl = protocol + '://' + host + this.basePath;
|
this.apiUrl = protocol + '://' + host + this.basePath;
|
||||||
if (this.apiUrl.endsWith('/')) {
|
if (this.apiUrl.endsWith('/')) {
|
||||||
this.apiUrl = this.apiUrl.substr(0, this.apiUrl.length - 1);
|
this.apiUrl = this.apiUrl.substr(0, this.apiUrl.length - 1);
|
||||||
|
|
|
@ -63,6 +63,13 @@ describe('Utils', () => {
|
||||||
specMgr.apiUrl.should.be.equal('http://petstore.swagger.io/v2');
|
specMgr.apiUrl.should.be.equal('http://petstore.swagger.io/v2');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should use empty basePath when basePath is not present', () => {
|
||||||
|
specMgr._schema.basePath = undefined;
|
||||||
|
specMgr._url = 'https://petstore.swagger.io';
|
||||||
|
specMgr.init();
|
||||||
|
specMgr.basePath.should.be.equal('');
|
||||||
|
});
|
||||||
|
|
||||||
describe('byPointer method', () => {
|
describe('byPointer method', () => {
|
||||||
it('should return correct schema part', ()=> {
|
it('should return correct schema part', ()=> {
|
||||||
let part = specMgr.byPointer('/tags/0');
|
let part = specMgr.byPointer('/tags/0');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user