File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { DEFAULT_HEADERS } from './lib/constants'
2
+ import { stripTrailingSlash } from './lib/helpers'
2
3
import { SupabaseClientOptions } from './lib/types'
3
4
import { SupabaseAuthClient } from './lib/SupabaseAuthClient'
4
5
import { SupabaseQueryBuilder } from './lib/SupabaseQueryBuilder'
@@ -51,6 +52,8 @@ export default class SupabaseClient {
51
52
if ( ! supabaseUrl ) throw new Error ( 'supabaseUrl is required.' )
52
53
if ( ! supabaseKey ) throw new Error ( 'supabaseKey is required.' )
53
54
55
+ supabaseUrl = stripTrailingSlash ( supabaseUrl )
56
+
54
57
const settings = { ...DEFAULT_OPTIONS , ...options }
55
58
this . restUrl = `${ supabaseUrl } /rest/v1`
56
59
this . realtimeUrl = `${ supabaseUrl } /realtime/v1` . replace ( 'http' , 'ws' )
Original file line number Diff line number Diff line change @@ -7,3 +7,7 @@ export function uuid() {
7
7
return v . toString ( 16 )
8
8
} )
9
9
}
10
+
11
+ export function stripTrailingSlash ( url : string ) {
12
+ return url . replace ( / \/ $ / , "" ) ;
13
+ }
You can’t perform that action at this time.
0 commit comments