From 6fd3c3896bee415c87835f716c698f6ceaad7528 Mon Sep 17 00:00:00 2001 From: DinethH Date: Fri, 1 Mar 2024 12:45:22 +0530 Subject: [PATCH] Request gets matched to resource correctly --- .../src/main/java/org/wso2/apk/enforcer/api/APIFactory.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/APIFactory.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/APIFactory.java index ab20bffc3..ea97c7f68 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/APIFactory.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/APIFactory.java @@ -138,6 +138,12 @@ public byte[] getAPIDefinition(final String basePath, final String version, fina public ResourceConfig getMatchedResource(API api, String matchedResourcePath, String method) { List resourceConfigList = api.getAPIConfig().getResources(); + if (APIConstants.ApiType.GRPC.equals(api.getAPIConfig().getApiType())) { + //TODO check if there's another way to do this, perhaps in the adapter side by setting the method + return resourceConfigList.stream() + .filter(resourceConfig -> resourceConfig.getPath().equals(matchedResourcePath)) + .findFirst().orElse(null); + } return resourceConfigList.stream() .filter(resourceConfig -> resourceConfig.getPath().equals(matchedResourcePath)). filter(resourceConfig -> (method == null) || resourceConfig.getMethod()