-
Notifications
You must be signed in to change notification settings - Fork 1
/
defaultConfiguration.go
34 lines (30 loc) · 1.01 KB
/
defaultConfiguration.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package pagarmeapisdk
import (
"github.com/apimatic/go-core-runtime/https"
"net/http"
)
func DefaultRetryConfiguration() https.RetryConfiguration {
return https.NewRetryConfiguration(
https.WithMaxRetryAttempts(0),
https.WithRetryOnTimeout(true),
https.WithRetryInterval(1),
https.WithMaximumRetryWaitTime(0),
https.WithBackoffFactor(2),
https.WithHttpStatusCodesToRetry([]int64{408, 413, 429, 500, 502, 503, 504, 521, 522, 524}),
https.WithHttpMethodsToRetry([]string{"GET", "PUT"}),
)
}
func DefaultHttpConfiguration() https.HttpConfiguration {
return https.NewHttpConfiguration(
https.WithTimeout(0),
https.WithTransport(http.DefaultTransport),
https.WithRetryConfiguration(DefaultRetryConfiguration()),
)
}
func DefaultConfiguration() Configuration {
return newConfiguration(
WithServiceRefererName(""),
WithEnvironment(PRODUCTION),
WithHttpConfiguration(DefaultHttpConfiguration()),
)
}