Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: defaultHeaders is optional #274

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const client = new ApiClient({
}),
basePath: GitHubV3RestApiServers.default(),
defaultTimeout: 5_000,
defaultHeaders: {},
})

async function main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const client = new ApiClient({
}),
basePath: "https://api.github.com",
defaultTimeout: 5_000,
defaultHeaders: {},
})

async function main() {
Expand Down
4 changes: 2 additions & 2 deletions packages/typescript-axios-runtime/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export type Server<T> = string & {__server__: T}
export interface AbstractAxiosConfig {
axios?: AxiosInstance
basePath: string
defaultHeaders: Record<string, string>
defaultHeaders?: Record<string, string>
defaultTimeout?: number
}

Expand All @@ -73,7 +73,7 @@ export abstract class AbstractAxiosClient {
protected constructor(config: AbstractAxiosConfig) {
this.axios = config.axios ?? axios
this.basePath = config.basePath
this.defaultHeaders = config.defaultHeaders
this.defaultHeaders = config.defaultHeaders ?? {}
this.defaultTimeout = config.defaultTimeout
}

Expand Down
4 changes: 2 additions & 2 deletions packages/typescript-fetch-runtime/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type Server<T> = string & {__server__: T}

export interface AbstractFetchClientConfig {
basePath: string
defaultHeaders: Record<string, string>
defaultHeaders?: Record<string, string>
defaultTimeout?: number
}

Expand Down Expand Up @@ -75,7 +75,7 @@ export abstract class AbstractFetchClient {

protected constructor(config: AbstractFetchClientConfig) {
this.basePath = config.basePath
this.defaultHeaders = config.defaultHeaders
this.defaultHeaders = config.defaultHeaders ?? {}
this.defaultTimeout = config.defaultTimeout
}

Expand Down
Loading