Skip to content

Commit

Permalink
Fix cache key generation with method
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK committed May 29, 2024
1 parent b08a3f0 commit c1c2a56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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? {
Expand Down
2 changes: 1 addition & 1 deletion ballerina/caching_http_cache.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}

0 comments on commit c1c2a56

Please sign in to comment.