From c1c2a560d984ed9edfde2d7cf6e1085b8c9f0637 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Wed, 29 May 2024 09:50:26 +0530 Subject: [PATCH] Fix cache key generation with method --- .../tests/http_cache_config_annotation_test.bal | 6 +++--- ballerina/caching_http_cache.bal | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ballerina-tests/http-advanced-tests/tests/http_cache_config_annotation_test.bal b/ballerina-tests/http-advanced-tests/tests/http_cache_config_annotation_test.bal index 54b925d9d2..e9afd1a256 100644 --- a/ballerina-tests/http-advanced-tests/tests/http_cache_config_annotation_test.bal +++ b/ballerina-tests/http-advanced-tests/tests/http_cache_config_annotation_test.bal @@ -331,11 +331,11 @@ function testReturnStatusCodeResponsesWithAnnotation() returns error? { function testBasicCachingBehaviourWithExecute() returns error? { check checkBasicCachingBehaviourWithExecute("GET", 1); runtime:sleep(1); - check checkBasicCachingBehaviourWithExecute("get", 2); + check checkBasicCachingBehaviourWithExecute("get", 1); runtime:sleep(1); - check checkBasicCachingBehaviourWithExecute("HEAD", 3); + check checkBasicCachingBehaviourWithExecute("HEAD", 2); runtime:sleep(1); - check checkBasicCachingBehaviourWithExecute("head", 4); + check checkBasicCachingBehaviourWithExecute("head", 2); } function checkBasicCachingBehaviourWithExecute(string method, int hitCount) returns error? { diff --git a/ballerina/caching_http_cache.bal b/ballerina/caching_http_cache.bal index cf300ffb8b..be06fd6d38 100644 --- a/ballerina/caching_http_cache.bal +++ b/ballerina/caching_http_cache.bal @@ -194,5 +194,5 @@ isolated function weakValidatorEquals(string etag1, string etag2) returns boolea } isolated function getCacheKey(string httpMethod, string url) returns string { - return string `${httpMethod} ${url}`; + return string `${httpMethod.toUpperAscii()} ${url}`; }