diff --git a/stdlib/http/src/main/java/org/ballerinalang/net/http/HttpConstants.java b/stdlib/http/src/main/java/org/ballerinalang/net/http/HttpConstants.java index 9cadc6f306f7..abb0d3d8b771 100644 --- a/stdlib/http/src/main/java/org/ballerinalang/net/http/HttpConstants.java +++ b/stdlib/http/src/main/java/org/ballerinalang/net/http/HttpConstants.java @@ -440,6 +440,7 @@ public class HttpConstants { public static final String DOLLAR = "$"; public static final String SINGLE_SLASH = "/"; public static final String REGEX = "(? 1 ? splittedUri[1] : EMPTY; - String basePath = servicesRegistry.findTheMostSpecificBasePath(validatedUri.getRawPath(), + String basePath = servicesRegistry.findTheMostSpecificBasePath(rawPathAndQuery[0], servicesOnInterface, sortedServiceURIs); if (basePath == null) { inboundReqMsg.setHttpStatusCode(404); throw new BallerinaConnectorException("no matching service found for path : " + - validatedUri.getRawPath()); + rawPathAndQuery[0]); } HttpService service = servicesOnInterface.get(basePath); - setInboundReqProperties(inboundReqMsg, validatedUri, basePath); + setInboundReqProperties(inboundReqMsg, rawPathAndQuery[0], basePath, rawPathAndQuery[1]); return service; } catch (Exception e) { throw new BallerinaConnectorException(e.getMessage()); } } - private static void setInboundReqProperties(HttpCarbonMessage inboundReqMsg, URI requestUri, String basePath) { - String subPath = URIUtil.getSubPath(requestUri.getRawPath(), basePath); + private static void setInboundReqProperties(HttpCarbonMessage inboundReqMsg, String rawPath, + String basePath, String rawQuery) { + String subPath = URIUtil.getSubPath(rawPath, basePath); inboundReqMsg.setProperty(HttpConstants.BASE_PATH, basePath); inboundReqMsg.setProperty(HttpConstants.SUB_PATH, subPath); - inboundReqMsg.setProperty(HttpConstants.QUERY_STR, requestUri.getQuery()); //store query params comes with request as it is - inboundReqMsg.setProperty(HttpConstants.RAW_QUERY_STR, requestUri.getRawQuery()); + inboundReqMsg.setProperty(HttpConstants.RAW_QUERY_STR, rawQuery); } public static URI getValidatedURI(String uriStr) {