From b92b648af0476713612b244c306107408427b4da Mon Sep 17 00:00:00 2001 From: AmaliMatharaarachchi Date: Thu, 14 Sep 2023 13:28:54 +0530 Subject: [PATCH] fix npe --- adapter/internal/oasparser/model/http_route.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adapter/internal/oasparser/model/http_route.go b/adapter/internal/oasparser/model/http_route.go index 35edc276d..af9a1e8f9 100644 --- a/adapter/internal/oasparser/model/http_route.go +++ b/adapter/internal/oasparser/model/http_route.go @@ -281,6 +281,7 @@ func (swagger *AdapterInternalAPI) SetInfoHTTPRouteCR(httpRoute *gwapiv1b1.HTTPR resourceAPIPolicy = concatAPIPolicies(resourceAPIPolicy, nil) resourceAuthScheme = concatAuthSchemes(resourceAuthScheme, nil) resourceRatelimitPolicy = concatRateLimitPolicies(resourceRatelimitPolicy, nil) + loggers.LoggerAPI.Error(resourceRatelimitPolicy) addOperationLevelInterceptors(&policies, resourceAPIPolicy, resourceParams.InterceptorServiceMapping, resourceParams.BackendMapping, httpRoute.Namespace) loggers.LoggerOasparser.Debugf("Calculating auths for API ..., API_UUID = %v", swagger.UUID) @@ -428,7 +429,7 @@ func getCorsConfigFromAPIPolicy(apiPolicy *dpv1alpha1.APIPolicy) *CorsConfig { func parseRateLimitPolicyToInternal(ratelimitPolicy *dpv1alpha1.RateLimitPolicy) *RateLimitPolicy { var rateLimitPolicyInternal *RateLimitPolicy - if ratelimitPolicy != nil { + if ratelimitPolicy != nil && ratelimitPolicy.Spec.Override != nil { if ratelimitPolicy.Spec.Override.API.RequestsPerUnit > 0 { rateLimitPolicyInternal = &RateLimitPolicy{ Count: ratelimitPolicy.Spec.Override.API.RequestsPerUnit,