Skip to content

Commit c1899ad

Browse files
committed
fix(client): createClient doesn't copy all settings of client
1 parent 2e2d4fb commit c1899ad

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packages/clients/src/scw/client.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { getLogger } from '../internal/logger'
22
import type { ClientConfig } from './client-ini-factory'
3-
import { withLegacyInterceptors, withProfile } from './client-ini-factory'
4-
import type { Profile } from './client-ini-profile'
3+
import {
4+
withAdditionalInterceptors,
5+
withLegacyInterceptors,
6+
withProfile,
7+
} from './client-ini-factory'
58
import type { Settings } from './client-settings'
69
import { assertValidSettings } from './client-settings'
710
import { userAgent, version } from './constants'
@@ -19,7 +22,7 @@ const DEFAULT_SETTINGS: Settings = {
1922
/**
2023
* Scaleway client.
2124
*/
22-
export type Client = {
25+
export interface Client {
2326
fetch: Fetcher
2427
settings: Settings
2528
}
@@ -99,5 +102,8 @@ export const createAdvancedClient = (...configs: ClientConfig[]): Client => {
99102
*
100103
* @public
101104
*/
102-
export const createClient = (profile: Profile = {}): Client =>
103-
createAdvancedClient(withProfile(profile))
105+
export const createClient = (settings: Partial<Settings>): Client =>
106+
createAdvancedClient(
107+
withProfile(settings),
108+
withAdditionalInterceptors(settings.interceptors ?? []),
109+
)

0 commit comments

Comments
 (0)