WithMiddleware returns a RequestOption that applies the given middleware to the requests made. Each middleware will execute in the order they were given.
(middlewares ...Middleware)
| 87 | // WithMiddleware returns a RequestOption that applies the given middleware |
| 88 | // to the requests made. Each middleware will execute in the order they were given. |
| 89 | func WithMiddleware(middlewares ...Middleware) RequestOption { |
| 90 | return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error { |
| 91 | r.Middlewares = append(r.Middlewares, middlewares...) |
| 92 | return nil |
| 93 | }) |
| 94 | } |
| 95 | |
| 96 | // WithMaxRetries returns a RequestOption that sets the maximum number of retries that the client |
| 97 | // attempts to make. When given 0, the client only makes one request. By |
searching dependent graphs…