Set url trailing slash (#5322)
This commit is contained in:
parent
e0c45b86b4
commit
812902dbe1
2 changed files with 11 additions and 1 deletions
|
|
@ -19,6 +19,16 @@ describe('Client4', () => {
|
|||
nock.restore();
|
||||
});
|
||||
|
||||
it('should remove trailing slash while trying to setUrl', () => {
|
||||
const client = TestHelper.createClient();
|
||||
|
||||
client.setUrl('http://localhost:8065/');
|
||||
expect(client.url).toBe('http://localhost:8065');
|
||||
|
||||
client.setUrl('http://localhost:8065/company/mattermost/');
|
||||
expect(client.url).toBe('http://localhost:8065/company/mattermost');
|
||||
});
|
||||
|
||||
describe('doFetchWithResponse', () => {
|
||||
it('serverVersion should be set from response header', async () => {
|
||||
const client = TestHelper.createClient();
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ export default class Client4 {
|
|||
}
|
||||
|
||||
setUrl(url: string) {
|
||||
this.url = url;
|
||||
this.url = url.replace(/\/+$/, '');
|
||||
}
|
||||
|
||||
setUserAgent(userAgent: string) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue