Skip to content

generate SDK with custom header #3429

@kossel

Description

@kossel

Description

Hi
Is there a way via either parser or operation, or something where we can inject custom headers? we use Accept-version header to tell sever which version we want, it's part of parameters.header['accept-version'].schema.default is there a way when generating the SDK, it adds that automatically?

export const postApiphotosV1 = <...>(options: Options<..>) => (options.client ?? client).post<...>({
    url: '/api/photos',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        'Accept-version': 1 // it will aways be parameters.header['accept-version'].schema.default
        ...options.headers
    }
});

I looked the documentations but couldn't find out if this is possible. BTW interceptor doesn't work since I would like this to be on build time (when generating sdk.gen) not run time, in runtime we don't have the spec anymore

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions