File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -812,6 +812,15 @@ describe('WebClient', () => {
812812 const client = new WebClient ( token , { allowAbsoluteUrls : false } ) ;
813813 await client . apiCall ( 'https://example.com/api/method' ) ;
814814 } ) ;
815+
816+ it ( 'should add a trailing slash to slackApiUrl if missing' , async ( ) => {
817+ const alternativeUrl = 'http://12.34.56.78/api' ; // No trailing slash here
818+ nock ( alternativeUrl )
819+ . post ( / a p i \/ m e t h o d / )
820+ . reply ( 200 , { ok : true } ) ;
821+ const client = new WebClient ( token , { slackApiUrl : alternativeUrl } ) ;
822+ await client . apiCall ( 'method' ) ;
823+ } ) ;
815824 } ) ;
816825
817826 describe ( 'has an option to set request concurrency' , ( ) => {
Original file line number Diff line number Diff line change @@ -314,7 +314,7 @@ export class WebClient extends Methods {
314314 this . axios = axios . create ( {
315315 adapter : adapter ? ( config : InternalAxiosRequestConfig ) => adapter ( { ...config , adapter : undefined } ) : undefined ,
316316 timeout,
317- baseURL : slackApiUrl ,
317+ baseURL : this . slackApiUrl ,
318318 headers : isElectron ( ) ? headers : { 'User-Agent' : getUserAgent ( ) , ...headers } ,
319319 httpAgent : agent ,
320320 httpsAgent : agent ,
You can’t perform that action at this time.
0 commit comments