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

Customize retry Handler Middleware #312

Open
ritu-rubrik opened this issue Jul 18, 2024 · 1 comment
Open

Customize retry Handler Middleware #312

ritu-rubrik opened this issue Jul 18, 2024 · 1 comment
Assignees

Comments

@ritu-rubrik
Copy link

Currently while using middlewate I use this code to get the default lit of middlewares.
defaultClientOptions := msgraph.GetDefaultClientOptions() defaultMiddleWare := msgraphgocore.GetDefaultMiddlewaresWithOptions(&defaultClientOptions)

However, I am not sure how to override the Retry handler alone in this list of middlewares.

Looking for an example to do this/

@ritu-rubrik ritu-rubrik added the status:waiting-for-triage An issue that is yet to be reviewed or assigned label Jul 18, 2024
@rkodev rkodev self-assigned this Jul 25, 2024
@rkodev
Copy link
Contributor

rkodev commented Aug 12, 2024

Hi @ritu-rubrik, thanks for trying out the SDK. If you would like to override the Retry handler, you are able to do it when executing the command i.e here is an example. You will only need to provide the retry option in the request configuration

	retryHandlerOptions := nethttplibrary.RetryHandlerOptions{
		ShouldRetry: func(delay time.Duration, executionCount int, request *http.Request, response *http.Response) bool {
			return false
		},
	}
	
	opts := applications.ApplicationsRequestBuilderGetRequestConfiguration{
		QueryParameters: &applications.ApplicationsRequestBuilderGetQueryParameters{
			Select: []string{"displayName", "appId", "id", "keyCredentials", "passwordCredentials"},
			Top:    to.Ptr[int32](100),
		},
		Options: []abstractions.RequestOption{&retryHandlerOptions},
	}

@rkodev rkodev added needs author feedback and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants