From 71e5b571620ed6c349cafdcb01f1e9cad9775a65 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 956f64fc3499c583eeb189d1e54e255d6a61c934 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 61300489b9c4e8c148d720583adb68564693fa65 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Wed, 29 May 2024 09:00:40 +0530 Subject: [PATCH 3/6] Update change log --- changelog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changelog.md b/changelog.md index 223f928814..1ed662d576 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.11.0] - 2024-05-03 ### Added From 4373863489a46ba84e947a250417d1f782b950a1 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Wed, 29 May 2024 09:01:02 +0530 Subject: [PATCH 4/6] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 6 +++--- ballerina/CompilerPlugin.toml | 2 +- ballerina/Dependencies.toml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 26dc5190d7..7600e65229 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.1" authors = ["Ballerina"] keywords = ["http", "network", "service", "listener", "client"] repository = "https://github.com/ballerina-platform/module-ballerina-http" @@ -16,8 +16,8 @@ graalvmCompatible = true [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" artifactId = "http-native" -version = "2.11.0" -path = "../native/build/libs/http-native-2.11.0.jar" +version = "2.11.1" +path = "../native/build/libs/http-native-2.11.1-SNAPSHOT.jar" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index 6e6d0a2804..94ed7849c8 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.11.0.jar" +path = "../compiler-plugin/build/libs/http-compiler-plugin-2.11.1-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index f160e6f988..2d75978fdb 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -50,7 +50,7 @@ modules = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.1" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -76,7 +76,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.1" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, From 72e19b839e630020e764c22ab5066f4307c08822 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Wed, 29 May 2024 09:11:51 +0530 Subject: [PATCH 5/6] [Automated] Update the native jar versions --- ballerina-tests/http-advanced-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-advanced-tests/Dependencies.toml | 8 ++++---- ballerina-tests/http-client-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-client-tests/Dependencies.toml | 8 ++++---- ballerina-tests/http-dispatching-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-dispatching-tests/Dependencies.toml | 8 ++++---- ballerina-tests/http-interceptor-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-interceptor-tests/Dependencies.toml | 8 ++++---- ballerina-tests/http-misc-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-misc-tests/Dependencies.toml | 8 ++++---- ballerina-tests/http-resiliency-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-resiliency-tests/Dependencies.toml | 8 ++++---- ballerina-tests/http-security-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-security-tests/Dependencies.toml | 8 ++++---- ballerina-tests/http-service-tests/Ballerina.toml | 6 +++--- ballerina-tests/http-service-tests/Dependencies.toml | 8 ++++---- 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 | 8 ++++---- 20 files changed, 65 insertions(+), 65 deletions(-) diff --git a/ballerina-tests/http-advanced-tests/Ballerina.toml b/ballerina-tests/http-advanced-tests/Ballerina.toml index b1ec75e241..72d5caca67 100644 --- a/ballerina-tests/http-advanced-tests/Ballerina.toml +++ b/ballerina-tests/http-advanced-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_advanced_tests" -version = "2.11.0" +version = "2.11.1" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.11.0" +version = "2.11.1" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.11.0.jar" +path = "../../test-utils/build/libs/http-test-utils-2.11.1-SNAPSHOT.jar" diff --git a/ballerina-tests/http-advanced-tests/Dependencies.toml b/ballerina-tests/http-advanced-tests/Dependencies.toml index bc9f24093f..5949cb4946 100644 --- a/ballerina-tests/http-advanced-tests/Dependencies.toml +++ b/ballerina-tests/http-advanced-tests/Dependencies.toml @@ -44,7 +44,7 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -72,7 +72,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -105,7 +105,7 @@ modules = [ [[package]] org = "ballerina" name = "http_advanced_tests" -version = "2.11.0" +version = "2.11.1" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "file"}, @@ -125,7 +125,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.11.0" +version = "2.11.1" 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 5cb5a402e5..eb14d27cb5 100644 --- a/ballerina-tests/http-client-tests/Ballerina.toml +++ b/ballerina-tests/http-client-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_client_tests" -version = "2.11.0" +version = "2.11.1" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.11.0" +version = "2.11.1" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.11.0.jar" +path = "../../test-utils/build/libs/http-test-utils-2.11.1-SNAPSHOT.jar" diff --git a/ballerina-tests/http-client-tests/Dependencies.toml b/ballerina-tests/http-client-tests/Dependencies.toml index aff2bd0983..2cdffe5129 100644 --- a/ballerina-tests/http-client-tests/Dependencies.toml +++ b/ballerina-tests/http-client-tests/Dependencies.toml @@ -47,7 +47,7 @@ modules = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -69,7 +69,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http_client_tests" -version = "2.11.0" +version = "2.11.1" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "http"}, @@ -121,7 +121,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.11.0" +version = "2.11.1" 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 93aa2c861c..29ade01652 100644 --- a/ballerina-tests/http-dispatching-tests/Ballerina.toml +++ b/ballerina-tests/http-dispatching-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_dispatching_tests" -version = "2.11.0" +version = "2.11.1" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.11.0" +version = "2.11.1" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.11.0.jar" +path = "../../test-utils/build/libs/http-test-utils-2.11.1-SNAPSHOT.jar" diff --git a/ballerina-tests/http-dispatching-tests/Dependencies.toml b/ballerina-tests/http-dispatching-tests/Dependencies.toml index e5ab8aed5a..82ecfd5eab 100644 --- a/ballerina-tests/http-dispatching-tests/Dependencies.toml +++ b/ballerina-tests/http-dispatching-tests/Dependencies.toml @@ -47,7 +47,7 @@ modules = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -69,7 +69,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http_dispatching_tests" -version = "2.11.0" +version = "2.11.1" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "http"}, @@ -124,7 +124,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.11.0" +version = "2.11.1" 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 3da3988af0..0d5fabd411 100644 --- a/ballerina-tests/http-interceptor-tests/Ballerina.toml +++ b/ballerina-tests/http-interceptor-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_interceptor_tests" -version = "2.11.0" +version = "2.11.1" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.11.0" +version = "2.11.1" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.11.0.jar" +path = "../../test-utils/build/libs/http-test-utils-2.11.1-SNAPSHOT.jar" diff --git a/ballerina-tests/http-interceptor-tests/Dependencies.toml b/ballerina-tests/http-interceptor-tests/Dependencies.toml index 8a1678ef54..4eb94ee92c 100644 --- a/ballerina-tests/http-interceptor-tests/Dependencies.toml +++ b/ballerina-tests/http-interceptor-tests/Dependencies.toml @@ -44,7 +44,7 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -66,7 +66,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -99,7 +99,7 @@ modules = [ [[package]] org = "ballerina" name = "http_interceptor_tests" -version = "2.11.0" +version = "2.11.1" 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.11.0" +version = "2.11.1" 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 678be821b7..66279c6f92 100644 --- a/ballerina-tests/http-misc-tests/Ballerina.toml +++ b/ballerina-tests/http-misc-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_misc_tests" -version = "2.11.0" +version = "2.11.1" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.11.0" +version = "2.11.1" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.11.0.jar" +path = "../../test-utils/build/libs/http-test-utils-2.11.1-SNAPSHOT.jar" diff --git a/ballerina-tests/http-misc-tests/Dependencies.toml b/ballerina-tests/http-misc-tests/Dependencies.toml index a624377821..9418edcff7 100644 --- a/ballerina-tests/http-misc-tests/Dependencies.toml +++ b/ballerina-tests/http-misc-tests/Dependencies.toml @@ -44,7 +44,7 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -66,7 +66,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -99,7 +99,7 @@ modules = [ [[package]] org = "ballerina" name = "http_misc_tests" -version = "2.11.0" +version = "2.11.1" 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.11.0" +version = "2.11.1" 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 5e045f5f2a..c991a7f9ad 100644 --- a/ballerina-tests/http-resiliency-tests/Ballerina.toml +++ b/ballerina-tests/http-resiliency-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_resiliency_tests" -version = "2.11.0" +version = "2.11.1" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.11.0" +version = "2.11.1" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.11.0.jar" +path = "../../test-utils/build/libs/http-test-utils-2.11.1-SNAPSHOT.jar" diff --git a/ballerina-tests/http-resiliency-tests/Dependencies.toml b/ballerina-tests/http-resiliency-tests/Dependencies.toml index b84c9afbf6..1902f5ad43 100644 --- a/ballerina-tests/http-resiliency-tests/Dependencies.toml +++ b/ballerina-tests/http-resiliency-tests/Dependencies.toml @@ -44,7 +44,7 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -66,7 +66,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -99,7 +99,7 @@ modules = [ [[package]] org = "ballerina" name = "http_resiliency_tests" -version = "2.11.0" +version = "2.11.1" 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.11.0" +version = "2.11.1" 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 2d16dd19ad..b1fbe2d86c 100644 --- a/ballerina-tests/http-security-tests/Ballerina.toml +++ b/ballerina-tests/http-security-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_security_tests" -version = "2.11.0" +version = "2.11.1" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.11.0" +version = "2.11.1" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.11.0.jar" +path = "../../test-utils/build/libs/http-test-utils-2.11.1-SNAPSHOT.jar" diff --git a/ballerina-tests/http-security-tests/Dependencies.toml b/ballerina-tests/http-security-tests/Dependencies.toml index 04bd6e9c08..d030995890 100644 --- a/ballerina-tests/http-security-tests/Dependencies.toml +++ b/ballerina-tests/http-security-tests/Dependencies.toml @@ -47,7 +47,7 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -69,7 +69,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http_security_tests" -version = "2.11.0" +version = "2.11.1" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "http"}, @@ -120,7 +120,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.11.0" +version = "2.11.1" 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 6fafd82909..79c4763805 100644 --- a/ballerina-tests/http-service-tests/Ballerina.toml +++ b/ballerina-tests/http-service-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_service_tests" -version = "2.11.0" +version = "2.11.1" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.11.0" +version = "2.11.1" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.11.0.jar" +path = "../../test-utils/build/libs/http-test-utils-2.11.1-SNAPSHOT.jar" diff --git a/ballerina-tests/http-service-tests/Dependencies.toml b/ballerina-tests/http-service-tests/Dependencies.toml index 4f13e605d1..9c983fffac 100644 --- a/ballerina-tests/http-service-tests/Dependencies.toml +++ b/ballerina-tests/http-service-tests/Dependencies.toml @@ -44,7 +44,7 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -69,7 +69,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http_service_tests" -version = "2.11.0" +version = "2.11.1" dependencies = [ {org = "ballerina", name = "file"}, {org = "ballerina", name = "http"}, @@ -121,7 +121,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.11.0" +version = "2.11.1" 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 e7b61366b7..58f1cb03ab 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.11.0" +version = "2.11.1" diff --git a/ballerina-tests/http-test-common/Dependencies.toml b/ballerina-tests/http-test-common/Dependencies.toml index acfa2c1956..fcb61bbb2e 100644 --- a/ballerina-tests/http-test-common/Dependencies.toml +++ b/ballerina-tests/http-test-common/Dependencies.toml @@ -10,7 +10,7 @@ distribution-version = "2201.9.0" [[package]] org = "ballerina" name = "http_test_common" -version = "2.11.0" +version = "2.11.1" 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 bb03dca848..a2206a5486 100644 --- a/ballerina-tests/http2-tests/Ballerina.toml +++ b/ballerina-tests/http2-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http2_tests" -version = "2.11.0" +version = "2.11.1" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.11.0" +version = "2.11.1" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.11.0.jar" +path = "../../test-utils/build/libs/http-test-utils-2.11.1-SNAPSHOT.jar" diff --git a/ballerina-tests/http2-tests/Dependencies.toml b/ballerina-tests/http2-tests/Dependencies.toml index 1cc1e0aa10..eb76a56238 100644 --- a/ballerina-tests/http2-tests/Dependencies.toml +++ b/ballerina-tests/http2-tests/Dependencies.toml @@ -44,7 +44,7 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "jballerina.java"}, @@ -69,7 +69,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http2_tests" -version = "2.11.0" +version = "2.11.1" dependencies = [ {org = "ballerina", name = "file"}, {org = "ballerina", name = "http"}, @@ -121,7 +121,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.11.0" +version = "2.11.1" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, From de2690469c76298c5b9e5dbd104d96b9011da9c1 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}`; }