File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed
Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,16 @@ export abstract class BaseResource {
4343 * @protected
4444 */
4545 protected buildPath ( id ?: string ) : string {
46- return id ? `${ this . basePath } /${ id } ` : this . basePath ;
46+ if ( ! id ) {
47+ return this . basePath ;
48+ }
49+
50+ // Handle empty basePath (used for resources with custom base URLs)
51+ if ( this . basePath === '' ) {
52+ return id ;
53+ }
54+
55+ return `${ this . basePath } /${ id } ` ;
4756 }
4857
4958 /**
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ describe('CheckoutSessionsResource', () => {
2323
2424 expect ( magpie . LAST_REQUEST ) . toMatchObject ( {
2525 method : 'POST' ,
26- url : expect . stringContaining ( '/ ' ) ,
26+ url : expect . stringContaining ( '' ) ,
2727 data : sessionData
2828 } ) ;
2929 } ) ;
@@ -86,7 +86,7 @@ describe('CheckoutSessionsResource', () => {
8686
8787 expect ( magpie . LAST_REQUEST ) . toMatchObject ( {
8888 method : 'GET' ,
89- url : expect . stringContaining ( `/ ${ sessionId } ` )
89+ url : expect . stringContaining ( sessionId )
9090 } ) ;
9191 } ) ;
9292
@@ -116,7 +116,7 @@ describe('CheckoutSessionsResource', () => {
116116
117117 expect ( magpie . LAST_REQUEST ) . toMatchObject ( {
118118 method : 'POST' ,
119- url : expect . stringContaining ( `/ ${ sessionId } /capture` ) ,
119+ url : expect . stringContaining ( `${ sessionId } /capture` ) ,
120120 data : captureData
121121 } ) ;
122122 } ) ;
@@ -154,7 +154,7 @@ describe('CheckoutSessionsResource', () => {
154154
155155 expect ( magpie . LAST_REQUEST ) . toMatchObject ( {
156156 method : 'POST' ,
157- url : expect . stringContaining ( `/ ${ sessionId } /expire` )
157+ url : expect . stringContaining ( `${ sessionId } /expire` )
158158 } ) ;
159159 } ) ;
160160
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export class CheckoutSessionsResource extends BaseResource {
4444 */
4545 constructor ( client : BaseClient ) {
4646 // Use different base URL for checkout sessions
47- super ( client , '/ ' , 'https://api.pay.magpie.im' ) ;
47+ super ( client , '' , 'https://api.pay.magpie.im' ) ;
4848 }
4949
5050 /**
You can’t perform that action at this time.
0 commit comments