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: added ability to specify headers for timeout and retries count #54

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

sunduckcow
Copy link
Contributor

You can add for your action config timeoutHeader and retryHeader and get these headers in request

timeoutHeader is for time in ms for timeout

retryHeader is for current retry attempt

const actions = {
    getHello: {
        method: 'GET',
        path: () => '/',
        timeoutHeader: 'x-request-timeout',
        retryHeader: 'x-request-attempt',
        retries: 3,
    },
}

@SeqviriouM
Copy link
Contributor

We have discussed and decided not to add new custom options timeoutHeader and retryHeader to ApiServiceRestActionConfig. Instead this we decided to add this custom headers to ApiParamsConfig to have ability to use them in params function

@@ -181,6 +181,8 @@ export interface ApiServiceRestActionConfig<
responseType?: AxiosRequestConfig['responseType'];
expectedResponseContentType?: ResponseContentType | ResponseContentType[];
maxRedirects?: number;
timeoutHeader?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А это еще нужно?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed them

@sunduckcow sunduckcow merged commit ee6d407 into main Jun 20, 2024
5 checks passed
@SeqviriouM SeqviriouM deleted the retry-and-timeout-headers branch June 20, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants