Skip to content

Commit c81182a

Browse files
export AddOption method in http service (#398)
Co-authored-by: Aryan Mehrotra <[email protected]>
1 parent c4c6555 commit c81182a

File tree

9 files changed

+10
-10
lines changed

9 files changed

+10
-10
lines changed

pkg/gofr/service/apikey_auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type APIKeyConfig struct {
99
APIKey string
1010
}
1111

12-
func (a *APIKeyConfig) addOption(h HTTP) HTTP {
12+
func (a *APIKeyConfig) AddOption(h HTTP) HTTP {
1313
return &APIKeyAuthProvider{
1414
apiKey: a.APIKey,
1515
HTTP: h,

pkg/gofr/service/basic_auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type BasicAuthConfig struct {
1111
Password string
1212
}
1313

14-
func (a *BasicAuthConfig) addOption(h HTTP) HTTP {
14+
func (a *BasicAuthConfig) AddOption(h HTTP) HTTP {
1515
return &BasicAuthProvider{
1616
userName: a.UserName,
1717
password: a.Password,

pkg/gofr/service/circuit_breaker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (cb *CircuitBreaker) resetFailureCount() {
142142
cb.failureCount = 0
143143
}
144144

145-
func (cb *CircuitBreakerConfig) addOption(h HTTP) HTTP {
145+
func (cb *CircuitBreakerConfig) AddOption(h HTTP) HTTP {
146146
return NewCircuitBreaker(*cb, h)
147147
}
148148

pkg/gofr/service/circuit_breaker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func setupHTTPServiceTestServerForCircuitBreaker() (*httptest.Server, HTTP) {
4444
}
4545

4646
// Apply circuit breaker option to the HTTP service
47-
httpservice := cbConfig.addOption(&service)
47+
httpservice := cbConfig.AddOption(&service)
4848

4949
return server, httpservice
5050
}

pkg/gofr/service/health_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type HealthConfig struct {
66
HealthEndpoint string
77
}
88

9-
func (h *HealthConfig) addOption(svc HTTP) HTTP {
9+
func (h *HealthConfig) AddOption(svc HTTP) HTTP {
1010
return &customHealthService{
1111
healthEndpoint: h.HealthEndpoint,
1212
HTTP: svc,

pkg/gofr/service/new.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func NewHTTPService(serviceAddress string, logger Logger, metrics Metrics, optio
8080

8181
// if options are given, then add them to the httpService struct
8282
for _, o := range options {
83-
svc = o.addOption(svc)
83+
svc = o.AddOption(svc)
8484
}
8585

8686
return svc

pkg/gofr/service/oauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type OAuthConfig struct {
3030
EndpointParams url.Values
3131
}
3232

33-
func (h *OAuthConfig) addOption(svc HTTP) HTTP {
33+
func (h *OAuthConfig) AddOption(svc HTTP) HTTP {
3434
return &oAuth{
3535
Config: clientcredentials.Config{
3636
ClientID: h.ClientID,

pkg/gofr/service/oauth_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func setupHTTPServiceTestServerForOAuth(server *httptest.Server) HTTP {
5454
}
5555

5656
// Apply circuit breaker option to the HTTP service
57-
httpSvc := oauthConfig.addOption(&service)
57+
httpSvc := oauthConfig.AddOption(&service)
5858

5959
return httpSvc
6060
}
@@ -71,7 +71,7 @@ func setupHTTPServiceTestServerForOAuthWithUnSupportedMethod() HTTP {
7171
oauthConfig := OAuthConfig{}
7272

7373
// Apply circuit breaker option to the HTTP service
74-
httpSvc := oauthConfig.addOption(&service)
74+
httpSvc := oauthConfig.AddOption(&service)
7575

7676
return httpSvc
7777
}

pkg/gofr/service/options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package service
22

33
type Options interface {
4-
addOption(h HTTP) HTTP
4+
AddOption(h HTTP) HTTP
55
}

0 commit comments

Comments
 (0)