From de8cc8b97df6b0a250fc26304ccd4d926d56bd91 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Tue, 28 May 2024 20:09:23 +0530 Subject: [PATCH 1/6] Fix http method check for caching --- ballerina/caching_http_caching_client.bal | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ballerina/caching_http_caching_client.bal b/ballerina/caching_http_caching_client.bal index bf1ce49d5d..52b83743ef 100644 --- a/ballerina/caching_http_caching_client.bal +++ b/ballerina/caching_http_caching_client.bal @@ -105,7 +105,7 @@ client isolated class HttpCachingClient { Request request = message; setRequestCacheControlHeader(request); - if httpMethod == HTTP_GET || httpMethod == HTTP_HEAD { + if httpMethod.equalsIgnoreCaseAscii(HTTP_GET) || httpMethod.equalsIgnoreCaseAscii(HTTP_HEAD) { return getCachedResponse(self.cache, self.httpClient, request, httpMethod, path, self.cacheConfig.isShared, false); } @@ -187,7 +187,7 @@ client isolated class HttpCachingClient { # + request - The HTTP request to be forwarded # + return - The response or an `http:ClientError` if failed to establish the communication with the upstream server remote isolated function forward(string path, Request request) returns Response|ClientError { - if request.method == HTTP_GET || request.method == HTTP_HEAD { + if request.method.equalsIgnoreCaseAscii(HTTP_GET) || request.method.equalsIgnoreCaseAscii(HTTP_HEAD) { return getCachedResponse(self.cache, self.httpClient, request, request.method, path, self.cacheConfig.isShared, true); } @@ -367,9 +367,9 @@ isolated function sendNewRequest(HttpClient httpClient, Request request, string if forwardRequest { return httpClient->forward(path, request); } - if httpMethod == HTTP_GET { + if httpMethod.equalsIgnoreCaseAscii(HTTP_GET) { return httpClient->get(path, message = request); - } else if httpMethod == HTTP_HEAD { + } else if httpMethod.equalsIgnoreCaseAscii(HTTP_HEAD) { return httpClient->head(path, message = request); } else { string message = "HTTP method not supported in caching client: " + httpMethod; From bcc8ce67ba62bb442f28b1e55ef604cc9c281225 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Wed, 29 May 2024 07:40:01 +0530 Subject: [PATCH 2/6] Add test cases --- .../http_cache_config_annotation_test.bal | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) 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 7dee547114..54b925d9d2 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 @@ -31,6 +31,7 @@ isolated int noCacheHitCountNew = 0; isolated int maxAgeHitCountNew = 0; isolated int numberOfHitsNew = 0; isolated int statusHits = 0; +isolated int greetingHits = 0; final readonly & xml maxAgePayload1 = xml `before cache expiration`; final readonly & xml maxAgePayload2 = xml `after cache expiration`; readonly & string errorBody = "Error"; @@ -160,6 +161,13 @@ service / on new http:Listener(cacheAnnotationTestPort2, httpVersion = http:HTTP return err; } } + + resource function default greeting() returns @http:Cache {maxAge: 10} json { + lock { + greetingHits += 1; + } + return {"message": "Hello, World!"}; + } } @test:Config {} @@ -318,3 +326,50 @@ function testReturnStatusCodeResponsesWithAnnotation() returns error? { common:assertTextPayload(response.getTextPayload(), errorBody); return; } + +@test:Config {} +function testBasicCachingBehaviourWithExecute() returns error? { + check checkBasicCachingBehaviourWithExecute("GET", 1); + runtime:sleep(1); + check checkBasicCachingBehaviourWithExecute("get", 2); + runtime:sleep(1); + check checkBasicCachingBehaviourWithExecute("HEAD", 3); + runtime:sleep(1); + check checkBasicCachingBehaviourWithExecute("head", 4); +} + +function checkBasicCachingBehaviourWithExecute(string method, int hitCount) returns error? { + http:Response|error response = cacheBackendEP->execute(method, "/greeting", new http:Request()); + if response is http:Response { + test:assertEquals(response.statusCode, 200, msg = "Found unexpected output"); + lock { + test:assertEquals(greetingHits, hitCount); + } + } else { + test:assertFail(msg = "Found unexpected output type: " + response.message()); + } + + runtime:sleep(1); + + response = cacheBackendEP->execute(method, "/greeting", new http:Request()); + if response is http:Response { + test:assertEquals(response.statusCode, 200, msg = "Found unexpected output"); + lock { + test:assertEquals(greetingHits, hitCount); + } + } else { + test:assertFail(msg = "Found unexpected output type: " + response.message()); + } + + runtime:sleep(1); + + response = cacheBackendEP->execute(method, "/greeting", new http:Request()); + if response is http:Response { + test:assertEquals(response.statusCode, 200, msg = "Found unexpected output"); + lock { + test:assertEquals(greetingHits, hitCount); + } + } else { + test:assertFail(msg = "Found unexpected output type: " + response.message()); + } +} From 383e0c6bd831704afdcb42736e5eb29cc015e10f Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Wed, 29 May 2024 07:55:56 +0530 Subject: [PATCH 3/6] [Automated] Update the native jar versions --- ballerina-tests/http-advanced-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-advanced-tests/Dependencies.toml | 6 +++--- ballerina-tests/http-client-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-client-tests/Dependencies.toml | 6 +++--- ballerina-tests/http-dispatching-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-dispatching-tests/Dependencies.toml | 6 +++--- ballerina-tests/http-interceptor-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-interceptor-tests/Dependencies.toml | 6 +++--- ballerina-tests/http-misc-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-misc-tests/Dependencies.toml | 6 +++--- ballerina-tests/http-resiliency-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-resiliency-tests/Dependencies.toml | 6 +++--- ballerina-tests/http-security-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-security-tests/Dependencies.toml | 6 +++--- ballerina-tests/http-service-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-service-tests/Dependencies.toml | 6 +++--- ballerina-tests/http-test-common/Ballerina.toml | 2 +- ballerina-tests/http-test-common/Dependencies.toml | 2 +- ballerina-tests/http2-tests/Ballerina.toml | 6 +++--- ballerina-tests/http2-tests/Dependencies.toml | 6 +++--- 20 files changed, 56 insertions(+), 56 deletions(-) diff --git a/ballerina-tests/http-advanced-tests/Ballerina.toml b/ballerina-tests/http-advanced-tests/Ballerina.toml index f625b937ad..4228c8ff61 100644 --- a/ballerina-tests/http-advanced-tests/Ballerina.toml +++ b/ballerina-tests/http-advanced-tests/Ballerina.toml @@ -1,14 +1,14 @@ [package] org = "ballerina" name = "http_advanced_tests" -version = "2.7.6" +version = "2.7.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.7.6" +version = "2.7.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.7.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.7.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-advanced-tests/Dependencies.toml b/ballerina-tests/http-advanced-tests/Dependencies.toml index 998c453457..2316ae21b2 100644 --- a/ballerina-tests/http-advanced-tests/Dependencies.toml +++ b/ballerina-tests/http-advanced-tests/Dependencies.toml @@ -73,7 +73,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -105,7 +105,7 @@ modules = [ [[package]] org = "ballerina" name = "http_advanced_tests" -version = "2.7.6" +version = "2.7.7" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "file"}, @@ -125,7 +125,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-client-tests/Ballerina.toml b/ballerina-tests/http-client-tests/Ballerina.toml index 90d9b768f2..03b3d523fa 100644 --- a/ballerina-tests/http-client-tests/Ballerina.toml +++ b/ballerina-tests/http-client-tests/Ballerina.toml @@ -1,14 +1,14 @@ [package] org = "ballerina" name = "http_client_tests" -version = "2.7.6" +version = "2.7.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.7.6" +version = "2.7.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.7.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.7.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-client-tests/Dependencies.toml b/ballerina-tests/http-client-tests/Dependencies.toml index 6388018802..301e1f2895 100644 --- a/ballerina-tests/http-client-tests/Dependencies.toml +++ b/ballerina-tests/http-client-tests/Dependencies.toml @@ -70,7 +70,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http_client_tests" -version = "2.7.6" +version = "2.7.7" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "http"}, @@ -121,7 +121,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-dispatching-tests/Ballerina.toml b/ballerina-tests/http-dispatching-tests/Ballerina.toml index 1f6667a80e..96cb6d8fec 100644 --- a/ballerina-tests/http-dispatching-tests/Ballerina.toml +++ b/ballerina-tests/http-dispatching-tests/Ballerina.toml @@ -1,14 +1,14 @@ [package] org = "ballerina" name = "http_dispatching_tests" -version = "2.7.6" +version = "2.7.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.7.6" +version = "2.7.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.7.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.7.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-dispatching-tests/Dependencies.toml b/ballerina-tests/http-dispatching-tests/Dependencies.toml index 3cbe0a7d9a..70328cc437 100644 --- a/ballerina-tests/http-dispatching-tests/Dependencies.toml +++ b/ballerina-tests/http-dispatching-tests/Dependencies.toml @@ -67,7 +67,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -99,7 +99,7 @@ modules = [ [[package]] org = "ballerina" name = "http_dispatching_tests" -version = "2.7.6" +version = "2.7.7" dependencies = [ {org = "ballerina", name = "http"}, {org = "ballerina", name = "http_test_common"}, @@ -120,7 +120,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-interceptor-tests/Ballerina.toml b/ballerina-tests/http-interceptor-tests/Ballerina.toml index ae29eb2baf..cea8bbd72d 100644 --- a/ballerina-tests/http-interceptor-tests/Ballerina.toml +++ b/ballerina-tests/http-interceptor-tests/Ballerina.toml @@ -1,14 +1,14 @@ [package] org = "ballerina" name = "http_interceptor_tests" -version = "2.7.6" +version = "2.7.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.7.6" +version = "2.7.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.7.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.7.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-interceptor-tests/Dependencies.toml b/ballerina-tests/http-interceptor-tests/Dependencies.toml index 55203a5430..f5acd12594 100644 --- a/ballerina-tests/http-interceptor-tests/Dependencies.toml +++ b/ballerina-tests/http-interceptor-tests/Dependencies.toml @@ -67,7 +67,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -99,7 +99,7 @@ modules = [ [[package]] org = "ballerina" name = "http_interceptor_tests" -version = "2.7.6" +version = "2.7.7" dependencies = [ {org = "ballerina", name = "http"}, {org = "ballerina", name = "http_test_common"}, @@ -115,7 +115,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-misc-tests/Ballerina.toml b/ballerina-tests/http-misc-tests/Ballerina.toml index 5bd36264c9..139dac0d3a 100644 --- a/ballerina-tests/http-misc-tests/Ballerina.toml +++ b/ballerina-tests/http-misc-tests/Ballerina.toml @@ -1,14 +1,14 @@ [package] org = "ballerina" name = "http_misc_tests" -version = "2.7.6" +version = "2.7.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.7.6" +version = "2.7.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.7.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.7.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-misc-tests/Dependencies.toml b/ballerina-tests/http-misc-tests/Dependencies.toml index 507edb7b1a..4cf0c8e24e 100644 --- a/ballerina-tests/http-misc-tests/Dependencies.toml +++ b/ballerina-tests/http-misc-tests/Dependencies.toml @@ -67,7 +67,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -99,7 +99,7 @@ modules = [ [[package]] org = "ballerina" name = "http_misc_tests" -version = "2.7.6" +version = "2.7.7" dependencies = [ {org = "ballerina", name = "http"}, {org = "ballerina", name = "http_test_common"}, @@ -118,7 +118,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-resiliency-tests/Ballerina.toml b/ballerina-tests/http-resiliency-tests/Ballerina.toml index 91d1d88c57..a13313d7eb 100644 --- a/ballerina-tests/http-resiliency-tests/Ballerina.toml +++ b/ballerina-tests/http-resiliency-tests/Ballerina.toml @@ -1,14 +1,14 @@ [package] org = "ballerina" name = "http_resiliency_tests" -version = "2.7.6" +version = "2.7.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.7.6" +version = "2.7.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.7.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.7.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-resiliency-tests/Dependencies.toml b/ballerina-tests/http-resiliency-tests/Dependencies.toml index 6d94786b93..751080ceaa 100644 --- a/ballerina-tests/http-resiliency-tests/Dependencies.toml +++ b/ballerina-tests/http-resiliency-tests/Dependencies.toml @@ -67,7 +67,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -99,7 +99,7 @@ modules = [ [[package]] org = "ballerina" name = "http_resiliency_tests" -version = "2.7.6" +version = "2.7.7" dependencies = [ {org = "ballerina", name = "http"}, {org = "ballerina", name = "http_test_common"}, @@ -116,7 +116,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-security-tests/Ballerina.toml b/ballerina-tests/http-security-tests/Ballerina.toml index f83c3b5482..1f146eec65 100644 --- a/ballerina-tests/http-security-tests/Ballerina.toml +++ b/ballerina-tests/http-security-tests/Ballerina.toml @@ -1,14 +1,14 @@ [package] org = "ballerina" name = "http_security_tests" -version = "2.7.6" +version = "2.7.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.7.6" +version = "2.7.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.7.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.7.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-security-tests/Dependencies.toml b/ballerina-tests/http-security-tests/Dependencies.toml index 13972bc78e..ae0136b7c1 100644 --- a/ballerina-tests/http-security-tests/Dependencies.toml +++ b/ballerina-tests/http-security-tests/Dependencies.toml @@ -70,7 +70,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http_security_tests" -version = "2.7.6" +version = "2.7.7" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "http"}, @@ -121,7 +121,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-service-tests/Ballerina.toml b/ballerina-tests/http-service-tests/Ballerina.toml index ed6af7fed6..4131719c69 100644 --- a/ballerina-tests/http-service-tests/Ballerina.toml +++ b/ballerina-tests/http-service-tests/Ballerina.toml @@ -1,14 +1,14 @@ [package] org = "ballerina" name = "http_service_tests" -version = "2.7.6" +version = "2.7.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.7.6" +version = "2.7.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.7.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.7.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-service-tests/Dependencies.toml b/ballerina-tests/http-service-tests/Dependencies.toml index 45bacb6a9d..baabb6989a 100644 --- a/ballerina-tests/http-service-tests/Dependencies.toml +++ b/ballerina-tests/http-service-tests/Dependencies.toml @@ -70,7 +70,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http_service_tests" -version = "2.7.6" +version = "2.7.7" dependencies = [ {org = "ballerina", name = "file"}, {org = "ballerina", name = "http"}, @@ -121,7 +121,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-test-common/Ballerina.toml b/ballerina-tests/http-test-common/Ballerina.toml index 293f3a92c1..7e2c202651 100644 --- a/ballerina-tests/http-test-common/Ballerina.toml +++ b/ballerina-tests/http-test-common/Ballerina.toml @@ -1,4 +1,4 @@ [package] org = "ballerina" name = "http_test_common" -version = "2.7.6" +version = "2.7.7" diff --git a/ballerina-tests/http-test-common/Dependencies.toml b/ballerina-tests/http-test-common/Dependencies.toml index fe7b279db9..0b228cfb5f 100644 --- a/ballerina-tests/http-test-common/Dependencies.toml +++ b/ballerina-tests/http-test-common/Dependencies.toml @@ -10,7 +10,7 @@ distribution-version = "2201.5.0" [[package]] org = "ballerina" name = "http_test_common" -version = "2.7.6" +version = "2.7.7" dependencies = [ {org = "ballerina", name = "lang.string"}, {org = "ballerina", name = "mime"}, diff --git a/ballerina-tests/http2-tests/Ballerina.toml b/ballerina-tests/http2-tests/Ballerina.toml index 8046d0b4ba..2900c19368 100644 --- a/ballerina-tests/http2-tests/Ballerina.toml +++ b/ballerina-tests/http2-tests/Ballerina.toml @@ -1,14 +1,14 @@ [package] org = "ballerina" name = "http2_tests" -version = "2.7.6" +version = "2.7.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.7.6" +version = "2.7.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.7.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.7.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http2-tests/Dependencies.toml b/ballerina-tests/http2-tests/Dependencies.toml index 39a828b8dd..88f72b7985 100644 --- a/ballerina-tests/http2-tests/Dependencies.toml +++ b/ballerina-tests/http2-tests/Dependencies.toml @@ -70,7 +70,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http2_tests" -version = "2.7.6" +version = "2.7.7" dependencies = [ {org = "ballerina", name = "file"}, {org = "ballerina", name = "http"}, @@ -121,7 +121,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.7.6" +version = "2.7.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, From e7e93089d2d1113bf248b220d2de13f6864cee5e Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Wed, 29 May 2024 07:55:56 +0530 Subject: [PATCH 4/6] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 6 +++--- ballerina/CompilerPlugin.toml | 2 +- ballerina/Dependencies.toml | 22 ++++++++++------------ 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index e0c70c3c4b..22debaa64e 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "http" -version = "2.7.6" +version = "2.7.7" authors = ["Ballerina"] keywords = ["http", "network", "service", "listener", "client"] repository = "https://github.com/ballerina-platform/module-ballerina-http" @@ -12,8 +12,8 @@ distribution = "2201.5.0" [[platform.java11.dependency]] groupId = "io.ballerina.stdlib" artifactId = "http-native" -version = "2.7.6" -path = "../native/build/libs/http-native-2.7.6.jar" +version = "2.7.7" +path = "../native/build/libs/http-native-2.7.7-SNAPSHOT.jar" [[platform.java11.dependency]] groupId = "io.ballerina.stdlib" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index 1c60023618..d2032627a4 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,4 +3,4 @@ id = "http-compiler-plugin" class = "io.ballerina.stdlib.http.compiler.HttpCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/http-compiler-plugin-2.7.6.jar" +path = "../compiler-plugin/build/libs/http-compiler-plugin-2.7.7-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 5b05673707..1b798afc06 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -51,7 +51,7 @@ modules = [ [[package]] org = "ballerina" name = "crypto" -version = "2.3.0" +version = "2.3.2" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -63,13 +63,11 @@ modules = [ [[package]] org = "ballerina" name = "file" -version = "1.7.0" +version = "1.7.1" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, - {org = "ballerina", name = "log"}, {org = "ballerina", name = "os"}, - {org = "ballerina", name = "regex"}, {org = "ballerina", name = "time"} ] modules = [ @@ -79,7 +77,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.7.6" +version = "2.7.7" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, @@ -110,7 +108,7 @@ modules = [ [[package]] org = "ballerina" name = "io" -version = "1.4.0" +version = "1.4.1" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} @@ -240,7 +238,7 @@ modules = [ [[package]] org = "ballerina" name = "log" -version = "2.7.0" +version = "2.7.1" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -254,7 +252,7 @@ modules = [ [[package]] org = "ballerina" name = "mime" -version = "2.7.0" +version = "2.7.1" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -304,7 +302,7 @@ dependencies = [ [[package]] org = "ballerina" name = "regex" -version = "1.4.0" +version = "1.4.3" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.string"} @@ -316,7 +314,7 @@ modules = [ [[package]] org = "ballerina" name = "task" -version = "2.3.1" +version = "2.3.2" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -325,7 +323,7 @@ dependencies = [ [[package]] org = "ballerina" name = "time" -version = "2.2.4" +version = "2.2.5" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -336,7 +334,7 @@ modules = [ [[package]] org = "ballerina" name = "url" -version = "2.2.3" +version = "2.2.4" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] From 6ec22122157708001c3f957aa48a59681c71886d Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Wed, 29 May 2024 08:00:33 +0530 Subject: [PATCH 5/6] Update change log --- changelog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changelog.md b/changelog.md index b5c75acd02..d0caacbed5 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,12 @@ This file contains all the notable changes done to the Ballerina HTTP package th The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- [Fix caching behaviour with client execute method](https://github.com/ballerina-platform/ballerina-library/issues/6570) + ## [2.7.6] - 2024-05-08 ### Added From d19e8083a021c2053af2ce4da6ec28b359ec21a8 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Wed, 29 May 2024 09:50:26 +0530 Subject: [PATCH 6/6] 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}`; }