diff --git a/ballerina-tests/http-advanced-tests/Ballerina.toml b/ballerina-tests/http-advanced-tests/Ballerina.toml index e70b40ff7a..60fbfeb941 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.8.6" +version = "2.8.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.8.6" +version = "2.8.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.8.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.8.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-advanced-tests/Dependencies.toml b/ballerina-tests/http-advanced-tests/Dependencies.toml index 1e9eb25815..1112469aa0 100644 --- a/ballerina-tests/http-advanced-tests/Dependencies.toml +++ b/ballerina-tests/http-advanced-tests/Dependencies.toml @@ -72,7 +72,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.8.6" +version = "2.8.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -104,7 +104,7 @@ modules = [ [[package]] org = "ballerina" name = "http_advanced_tests" -version = "2.8.6" +version = "2.8.7" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "file"}, @@ -124,7 +124,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.8.6" +version = "2.8.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, 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..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 @@ -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", 1); + runtime:sleep(1); + check checkBasicCachingBehaviourWithExecute("HEAD", 2); + runtime:sleep(1); + check checkBasicCachingBehaviourWithExecute("head", 2); +} + +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()); + } +} diff --git a/ballerina-tests/http-client-tests/Ballerina.toml b/ballerina-tests/http-client-tests/Ballerina.toml index 728c6841f2..b3e33a0368 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.8.6" +version = "2.8.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.8.6" +version = "2.8.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.8.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.8.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-client-tests/Dependencies.toml b/ballerina-tests/http-client-tests/Dependencies.toml index fa7b9fd5bd..649ff4acbb 100644 --- a/ballerina-tests/http-client-tests/Dependencies.toml +++ b/ballerina-tests/http-client-tests/Dependencies.toml @@ -69,7 +69,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.8.6" +version = "2.8.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -101,7 +101,7 @@ modules = [ [[package]] org = "ballerina" name = "http_client_tests" -version = "2.8.6" +version = "2.8.7" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "http"}, @@ -120,7 +120,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.8.6" +version = "2.8.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 ae4ae50167..9ddfa249e6 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.8.6" +version = "2.8.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.8.6" +version = "2.8.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.8.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.8.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-dispatching-tests/Dependencies.toml b/ballerina-tests/http-dispatching-tests/Dependencies.toml index ce78873752..914fbd2ceb 100644 --- a/ballerina-tests/http-dispatching-tests/Dependencies.toml +++ b/ballerina-tests/http-dispatching-tests/Dependencies.toml @@ -69,7 +69,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.8.6" +version = "2.8.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -101,7 +101,7 @@ modules = [ [[package]] org = "ballerina" name = "http_dispatching_tests" -version = "2.8.6" +version = "2.8.7" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "http"}, @@ -123,7 +123,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.8.6" +version = "2.8.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 a88f4abaf7..cef3db13a6 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.8.6" +version = "2.8.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.8.6" +version = "2.8.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.8.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.8.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-interceptor-tests/Dependencies.toml b/ballerina-tests/http-interceptor-tests/Dependencies.toml index 873ec10f48..1129b506cb 100644 --- a/ballerina-tests/http-interceptor-tests/Dependencies.toml +++ b/ballerina-tests/http-interceptor-tests/Dependencies.toml @@ -66,7 +66,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.8.6" +version = "2.8.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -98,7 +98,7 @@ modules = [ [[package]] org = "ballerina" name = "http_interceptor_tests" -version = "2.8.6" +version = "2.8.7" dependencies = [ {org = "ballerina", name = "http"}, {org = "ballerina", name = "http_test_common"}, @@ -114,7 +114,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.8.6" +version = "2.8.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 fc2c16a181..b853c33d28 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.8.6" +version = "2.8.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.8.6" +version = "2.8.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.8.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.8.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-misc-tests/Dependencies.toml b/ballerina-tests/http-misc-tests/Dependencies.toml index 79d2ae04da..ed904ca4f7 100644 --- a/ballerina-tests/http-misc-tests/Dependencies.toml +++ b/ballerina-tests/http-misc-tests/Dependencies.toml @@ -66,7 +66,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.8.6" +version = "2.8.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -98,7 +98,7 @@ modules = [ [[package]] org = "ballerina" name = "http_misc_tests" -version = "2.8.6" +version = "2.8.7" dependencies = [ {org = "ballerina", name = "http"}, {org = "ballerina", name = "http_test_common"}, @@ -117,7 +117,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.8.6" +version = "2.8.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 5b11f4b9f9..6ec80ec26b 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.8.6" +version = "2.8.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.8.6" +version = "2.8.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.8.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.8.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-resiliency-tests/Dependencies.toml b/ballerina-tests/http-resiliency-tests/Dependencies.toml index 0d9dc3c1f9..a1771d090d 100644 --- a/ballerina-tests/http-resiliency-tests/Dependencies.toml +++ b/ballerina-tests/http-resiliency-tests/Dependencies.toml @@ -66,7 +66,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.8.6" +version = "2.8.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -98,7 +98,7 @@ modules = [ [[package]] org = "ballerina" name = "http_resiliency_tests" -version = "2.8.6" +version = "2.8.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.8.6" +version = "2.8.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 6611696384..946f92396f 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.8.6" +version = "2.8.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.8.6" +version = "2.8.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.8.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.8.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-security-tests/Dependencies.toml b/ballerina-tests/http-security-tests/Dependencies.toml index 1c0db09ffb..f0b55ac177 100644 --- a/ballerina-tests/http-security-tests/Dependencies.toml +++ b/ballerina-tests/http-security-tests/Dependencies.toml @@ -69,7 +69,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.8.6" +version = "2.8.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -101,7 +101,7 @@ modules = [ [[package]] org = "ballerina" name = "http_security_tests" -version = "2.8.6" +version = "2.8.7" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "http"}, @@ -119,7 +119,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.8.6" +version = "2.8.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 e894f82fa0..2a56ee8e1c 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.8.6" +version = "2.8.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.8.6" +version = "2.8.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.8.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.8.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http-service-tests/Dependencies.toml b/ballerina-tests/http-service-tests/Dependencies.toml index adbcdced85..13e7c68e45 100644 --- a/ballerina-tests/http-service-tests/Dependencies.toml +++ b/ballerina-tests/http-service-tests/Dependencies.toml @@ -69,7 +69,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.8.6" +version = "2.8.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -101,7 +101,7 @@ modules = [ [[package]] org = "ballerina" name = "http_service_tests" -version = "2.8.6" +version = "2.8.7" dependencies = [ {org = "ballerina", name = "file"}, {org = "ballerina", name = "http"}, @@ -120,7 +120,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.8.6" +version = "2.8.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 e0df483621..138c887e66 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.8.6" +version = "2.8.7" diff --git a/ballerina-tests/http-test-common/Dependencies.toml b/ballerina-tests/http-test-common/Dependencies.toml index 88096037b4..7fc3d47e13 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.8.6" +version = "2.8.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 91c4cbda81..bed28e018a 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.8.6" +version = "2.8.7" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.8.6" +version = "2.8.7" [[platform.java11.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.8.6.jar" +path = "../../test-utils/build/libs/http-test-utils-2.8.7-SNAPSHOT.jar" diff --git a/ballerina-tests/http2-tests/Dependencies.toml b/ballerina-tests/http2-tests/Dependencies.toml index e96fb8fb22..917a59bb20 100644 --- a/ballerina-tests/http2-tests/Dependencies.toml +++ b/ballerina-tests/http2-tests/Dependencies.toml @@ -69,7 +69,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.8.6" +version = "2.8.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -101,7 +101,7 @@ modules = [ [[package]] org = "ballerina" name = "http2_tests" -version = "2.8.6" +version = "2.8.7" dependencies = [ {org = "ballerina", name = "file"}, {org = "ballerina", name = "http"}, @@ -120,7 +120,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.8.6" +version = "2.8.7" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 26f0c688ab..941d85e8c7 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "http" -version = "2.8.6" +version = "2.8.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.8.6" -path = "../native/build/libs/http-native-2.8.6.jar" +version = "2.8.7" +path = "../native/build/libs/http-native-2.8.7-SNAPSHOT.jar" [[platform.java11.dependency]] groupId = "io.ballerina.stdlib" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index 80957b31f6..b9889d0e4b 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.8.6.jar" +path = "../compiler-plugin/build/libs/http-compiler-plugin-2.8.7-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index b9e7718004..eb8669580a 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -50,7 +50,7 @@ modules = [ [[package]] org = "ballerina" name = "crypto" -version = "2.3.1" +version = "2.3.2" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -76,7 +76,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.8.6" +version = "2.8.7" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, @@ -312,7 +312,7 @@ dependencies = [ [[package]] org = "ballerina" name = "time" -version = "2.2.4" +version = "2.2.5" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -323,7 +323,7 @@ modules = [ [[package]] org = "ballerina" name = "url" -version = "2.2.3" +version = "2.2.4" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] 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}`; } 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; diff --git a/changelog.md b/changelog.md index 0950b9d22e..d92e975f25 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.8.6] - 2024-05-08 ### Added