diff --git a/ballerina-tests/http-dispatching-tests/tests/header_params_binding_test.bal b/ballerina-tests/http-dispatching-tests/tests/header_params_binding_test.bal index dd6f3ad547..f4984515e9 100644 --- a/ballerina-tests/http-dispatching-tests/tests/header_params_binding_test.bal +++ b/ballerina-tests/http-dispatching-tests/tests/header_params_binding_test.bal @@ -121,3 +121,66 @@ function testHeaderParamBindingCase9() returns error? { http:Response res = check resourceHeaderParamBindingClient->/header/case9(headers); test:assertEquals(res.statusCode, 400); } + +@test:Config {} +function testHeaderParamBindingCase10() returns error? { + int:Signed32 resPayload = check resourceHeaderParamBindingClient->/header/case10({header: "32"}); + test:assertEquals(resPayload, 32); + + resPayload = check resourceHeaderParamBindingClient->/header/case10({header: "-32"}); + test:assertEquals(resPayload, -32); + + http:Response res = check resourceHeaderParamBindingClient->/header/case10({header: "5000000000"}); + test:assertEquals(res.statusCode, 400); +} + +@test:Config {} +function testHeaderParamBindingCase11() returns error? { + int:Unsigned32 resPayload = check resourceHeaderParamBindingClient->/header/case11({header: "32"}); + test:assertEquals(resPayload, 32); + + http:Response res = check resourceHeaderParamBindingClient->/header/case11({header: "-32"}); + test:assertEquals(res.statusCode, 400); + + res = check resourceHeaderParamBindingClient->/header/case11({header: "5000000000"}); + test:assertEquals(res.statusCode, 400); +} + +@test:Config {} +function testHeaderParamBindingCase12() returns error? { + int:Signed8[] resPayload = check resourceHeaderParamBindingClient->/header/case12({header: ["32", "-38", "1", "-43"]}); + test:assertEquals(resPayload, [32, -38, 1, -43]); + + http:Response res = check resourceHeaderParamBindingClient->/header/case12({header: ["32", "-38", "1", "-43", "-50000000"]}); + test:assertEquals(res.statusCode, 400); +} + +@test:Config {} +function testHeaderParamBindingCase13() returns error? { + string:Char resPayload = check resourceHeaderParamBindingClient->/header/case13({header: "a"}); + test:assertEquals(resPayload, "a"); + + resPayload = check resourceHeaderParamBindingClient->/header/case13({header: "*"}); + test:assertEquals(resPayload, "*"); + + http:Response res = check resourceHeaderParamBindingClient->/header/case13({header: "ab"}); + test:assertEquals(res.statusCode, 400); +} + +@test:Config {} +function testHeaderParamBindingCase14() returns error? { + [StringCharacter, SmallInt] resPayload = check resourceHeaderParamBindingClient->/header/case14({header1: "a", header2: "32"}); + test:assertEquals(resPayload, ["a", 32]); + + resPayload = check resourceHeaderParamBindingClient->/header/case14({header1: "*", header2: "-32"}); + test:assertEquals(resPayload, ["*", -32]); + + http:Response res = check resourceHeaderParamBindingClient->/header/case14({header1: "ab", header2: "32"}); + test:assertEquals(res.statusCode, 400); + + res = check resourceHeaderParamBindingClient->/header/case14({header1: "a", header2: "5000000000"}); + test:assertEquals(res.statusCode, 400); + + res = check resourceHeaderParamBindingClient->/header/case14({header1: "ab", header2: "5000000000"}); + test:assertEquals(res.statusCode, 400); +} diff --git a/ballerina-tests/http-dispatching-tests/tests/path_params_binding_test.bal b/ballerina-tests/http-dispatching-tests/tests/path_params_binding_test.bal index 3d1b809f58..8e04b4e2a4 100644 --- a/ballerina-tests/http-dispatching-tests/tests/path_params_binding_test.bal +++ b/ballerina-tests/http-dispatching-tests/tests/path_params_binding_test.bal @@ -17,6 +17,7 @@ import ballerina/test; import ballerina/http; import ballerina/http_test_common as common; +import ballerina/url; final http:Client resourcePathParamBindingClient = check new("http://localhost:" + resourceParamBindingTestPort.toString()); @@ -145,3 +146,69 @@ function testPathParamBindingCase10() returns error? { http:Response res = check resourcePathParamBindingClient->/path/case10/value1/value9/value3; test:assertEquals(res.statusCode, 404, "Status code mismatched"); } + +@test:Config {} +function testPathParamBindingCase11() returns error? { + int:Signed32 resPayload = check resourcePathParamBindingClient->/path/case11/'32; + test:assertEquals(resPayload, 32, "Payload mismatched"); + + resPayload = check resourcePathParamBindingClient->/path/case11/\-32; + test:assertEquals(resPayload, -32, "Payload mismatched"); + + http:Response res = check resourcePathParamBindingClient->/path/case11/'5000000000; + test:assertEquals(res.statusCode, 400, "Status code mismatched"); +} + +@test:Config {} +function testPathParamBindingCase12() returns error? { + int:Unsigned32 resPayload = check resourcePathParamBindingClient->/path/case12/'32; + test:assertEquals(resPayload, 32, "Payload mismatched"); + + http:Response res = check resourcePathParamBindingClient->/path/case12/\-32; + test:assertEquals(res.statusCode, 400, "Status code mismatched"); + + res = check resourcePathParamBindingClient->/path/case12/'5000000000; + test:assertEquals(res.statusCode, 400, "Status code mismatched"); +} + +@test:Config {} +function testPathParamBindingCase13() returns error? { + int:Signed8[] resPayload = check resourcePathParamBindingClient->/path/case13/'32/\-38/'1/\-43; + test:assertEquals(resPayload, [32, -38, 1, -43], "Payload mismatched"); + + http:Response res = check resourcePathParamBindingClient->/path/case13/'32/\-38/'1/\-43/'5000000000; + test:assertEquals(res.statusCode, 400, "Status code mismatched"); +} + +@test:Config {} +function testPathParamBindingCase14() returns error? { + string:Char resPayload = check resourcePathParamBindingClient->/path/case14/a; + test:assertEquals(resPayload, "a", "Payload mismatched"); + + resPayload = check resourcePathParamBindingClient->/path/case14/[check url:encode("*", "UTF-8")]; + test:assertEquals(resPayload, "*", "Payload mismatched"); + + resPayload = check resourcePathParamBindingClient->/path/case14/[check url:encode(" ", "UTF-8")]; + test:assertEquals(resPayload, " ", "Payload mismatched"); + + http:Response res = check resourcePathParamBindingClient->/path/case14/abc; + test:assertEquals(res.statusCode, 400, "Status code mismatched"); +} + +@test:Config {} +function testPathParamBindingCase15() returns error? { + [StringCharacter, SmallInt] resPayload = check resourcePathParamBindingClient->/path/case15/[check url:encode("*", "UTF-8")]/'34; + test:assertEquals(resPayload, ["*", 34], "Payload mismatched"); + + resPayload = check resourcePathParamBindingClient->/path/case15/[check url:encode(" ", "UTF-8")]/\-34; + test:assertEquals(resPayload, [" ", -34], "Payload mismatched"); + + http:Response res = check resourcePathParamBindingClient->/path/case15/a/'5000000; + test:assertEquals(res.statusCode, 400, "Status code mismatched"); + + res = check resourcePathParamBindingClient->/path/case15/ab/'32; + test:assertEquals(res.statusCode, 400, "Status code mismatched"); + + res = check resourcePathParamBindingClient->/path/case15/abc/'5000000; + test:assertEquals(res.statusCode, 400, "Status code mismatched"); +} diff --git a/ballerina-tests/http-dispatching-tests/tests/query_params_binding_test.bal b/ballerina-tests/http-dispatching-tests/tests/query_params_binding_test.bal index ee43cbcf02..03c72a9a30 100644 --- a/ballerina-tests/http-dispatching-tests/tests/query_params_binding_test.bal +++ b/ballerina-tests/http-dispatching-tests/tests/query_params_binding_test.bal @@ -152,3 +152,68 @@ function testQueryParamBindingCase10() returns error? { test:assertEquals(res.statusCode, 400, "Status code mismatched"); } +@test:Config {} +function testQueryParamBindingCase11() returns error? { + int:Signed32 resPayload = check resourceQueryParamBindingClient->/query/case11(query = 32); + test:assertEquals(resPayload, 32, "Payload mismatched"); + + resPayload = check resourceQueryParamBindingClient->/query/case11(query = -32); + test:assertEquals(resPayload, -32, "Payload mismatched"); + + http:Response res = check resourceQueryParamBindingClient->/query/case11(query = 5000000000); + test:assertEquals(res.statusCode, 400, "Status code mismatched"); +} + +@test:Config {} +function testQueryParamBindingCase12() returns error? { + int:Unsigned32 resPayload = check resourceQueryParamBindingClient->/query/case12(query = 32); + test:assertEquals(resPayload, 32, "Payload mismatched"); + + http:Response res = check resourceQueryParamBindingClient->/query/case12(query = -32); + test:assertEquals(res.statusCode, 400, "Status code mismatched"); + + res = check resourceQueryParamBindingClient->/query/case12(query = 5000000000); + test:assertEquals(res.statusCode, 400, "Status code mismatched"); +} + +@test:Config {} +function testQueryParamBindingCase13() returns error? { + int:Signed8[] resPayload = check resourceQueryParamBindingClient->/query/case13(query = [32, -38, 1, -43]); + test:assertEquals(resPayload, [32, -38, 1, -43], "Payload mismatched"); + + http:Response res = check resourceQueryParamBindingClient->/query/case13(query = [32, -38, 1, -43, 50000000]); + test:assertEquals(res.statusCode, 400, "Status code mismatched"); +} + +@test:Config {} +function testQueryParamBindingCase14() returns error? { + string:Char resPayload = check resourceQueryParamBindingClient->/query/case14(query = "a"); + test:assertEquals(resPayload, "a", "Payload mismatched"); + + resPayload = check resourceQueryParamBindingClient->/query/case14(query = "*"); + test:assertEquals(resPayload, "*", "Payload mismatched"); + + resPayload = check resourceQueryParamBindingClient->/query/case14(query = "."); + test:assertEquals(resPayload, ".", "Payload mismatched"); + + http:Response res = check resourceQueryParamBindingClient->/query/case14(query = "ab"); + test:assertEquals(res.statusCode, 400, "Status code mismatched"); +} + +@test:Config {} +function testQueryParamBindingCase15() returns error? { + [StringCharacter, SmallInt] resPayload = check resourceQueryParamBindingClient->/query/case15(query1 = "*", query2 = 34); + test:assertEquals(resPayload, ["*", 34], "Payload mismatched"); + + resPayload = check resourceQueryParamBindingClient->/query/case15(query1 = " ", query2 = -34); + test:assertEquals(resPayload, [" ", -34], "Payload mismatched"); + + http:Response res = check resourceQueryParamBindingClient->/query/case15(query1 = "ab", query2 = 34); + test:assertEquals(res.statusCode, 400, "Status code mismatched"); + + res = check resourceQueryParamBindingClient->/query/case15(query1 = "*", query2 = 500000); + test:assertEquals(res.statusCode, 400, "Status code mismatched"); + + res = check resourceQueryParamBindingClient->/query/case15(query1 = "abc", query2 = 500000); + test:assertEquals(res.statusCode, 400, "Status code mismatched"); +} diff --git a/ballerina-tests/http-dispatching-tests/tests/resource_params_binding_test_common.bal b/ballerina-tests/http-dispatching-tests/tests/resource_params_binding_test_common.bal index d254a6f801..20579dd415 100644 --- a/ballerina-tests/http-dispatching-tests/tests/resource_params_binding_test_common.bal +++ b/ballerina-tests/http-dispatching-tests/tests/resource_params_binding_test_common.bal @@ -44,6 +44,9 @@ type QueryRecord record {| type QueryRecordCombined QueryRecord|map; +type StringCharacter string:Char; +type SmallInt int:Signed8; + listener http:Listener resourceParamBindingListener = new(resourceParamBindingTestPort); service /path on resourceParamBindingListener { @@ -104,6 +107,26 @@ service /path on resourceParamBindingListener { } return result; } + + resource function get case11/[int:Signed32 path]() returns int:Signed32 { + return path; + } + + resource function get case12/[int:Unsigned32 path]() returns int:Unsigned32 { + return path; + } + + resource function get case13/[int:Signed8... path]() returns int:Signed8[] { + return path; + } + + resource function get case14/[string:Char path]() returns string:Char { + return path; + } + + resource function get case15/[StringCharacter path1]/[SmallInt path2]() returns [StringCharacter, SmallInt] { + return [path1, path2]; + } } service /query on resourceParamBindingListener { @@ -176,6 +199,26 @@ service /query on resourceParamBindingListener { } return result; } + + resource function get case11(int:Signed32 query) returns int:Signed32 { + return query; + } + + resource function get case12(int:Unsigned32 query) returns int:Unsigned32 { + return query; + } + + resource function get case13(int:Signed8[] query) returns int:Signed8[] { + return query; + } + + resource function get case14(string:Char query) returns string:Char { + return query; + } + + resource function get case15(StringCharacter query1, SmallInt query2) returns [StringCharacter, SmallInt] { + return [query1, query2]; + } } service /header on resourceParamBindingListener { @@ -226,5 +269,25 @@ service /header on resourceParamBindingListener { resource function get case9(@http:Header HeaderRecord? header) returns map|string { return header ?: "default"; } + + resource function get case10(@http:Header int:Signed32 header) returns int:Signed32 { + return header; + } + + resource function get case11(@http:Header int:Unsigned32 header) returns int:Unsigned32 { + return header; + } + + resource function get case12(@http:Header int:Signed8[] header) returns int:Signed8[] { + return header; + } + + resource function get case13(@http:Header string:Char header) returns string:Char { + return header; + } + + resource function get case14(@http:Header StringCharacter header1, @http:Header SmallInt header2) returns [StringCharacter, SmallInt] { + return [header1, header2]; + } } diff --git a/changelog.md b/changelog.md index 323d568c44..08f09dd999 100644 --- a/changelog.md +++ b/changelog.md @@ -5,7 +5,13 @@ 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] +## [2.8.0] - 2023-06-01 + +### Added + +- [Add query,header and path parameter runtime support for Ballerina builtin types](https://github.com/ballerina-platform/ballerina-standard-library/issues/4526) + +## [2.8.0] - 2023-06-01 ### Fixed diff --git a/load-tests/h1_h1_passthrough/results/summary.csv b/load-tests/h1_h1_passthrough/results/summary.csv index cb5422e4f8..6922f78f0a 100644 --- a/load-tests/h1_h1_passthrough/results/summary.csv +++ b/load-tests/h1_h1_passthrough/results/summary.csv @@ -325,3 +325,5 @@ HTTP Request,9586725,19,13,42,57,99,0,744,0.00%,2754.8,661.8,20.51,1685297679,50 HTTP Request,9348074,20,14,43,59,101,0,818,0.00%,2686.3,645.3,20.83,1685384091,50,60 HTTP Request,9507549,19,13,42,57,99,0,718,0.00%,2732.1,656.3,20.33,1685470479,50,60 HTTP Request,9924731,18,13,41,55,96,0,726,0.00%,2852.0,685.1,19.84,1685556867,50,60 +HTTP Request,9470373,19,13,43,58,100,0,740,0.00%,2721.4,653.8,20.62,1685643309,50,60 +HTTP Request,9520610,19,13,42,57,100,0,867,0.00%,2735.9,657.2,20.50,1685729722,50,60 diff --git a/load-tests/h1_transformation/results/summary.csv b/load-tests/h1_transformation/results/summary.csv index 18ee7e3f84..3728e9d72a 100644 --- a/load-tests/h1_transformation/results/summary.csv +++ b/load-tests/h1_transformation/results/summary.csv @@ -328,3 +328,5 @@ HTTP Request,7557457,26,23,48,58,87,1,569,0.00%,2171.7,593.8,17.26,1685301648,50 HTTP Request,7717333,26,23,46,56,83,1,418,0.00%,2217.7,606.4,16.37,1685388074,50,60 HTTP Request,7826624,25,22,46,56,83,1,446,0.00%,2249.1,615.0,16.44,1685474432,50,60 HTTP Request,8283128,24,21,43,53,78,1,527,0.00%,2380.2,650.8,15.49,1685560824,50,60 +HTTP Request,8064653,24,22,44,54,80,1,425,0.00%,2317.5,633.7,15.94,1685647272,50,60 +HTTP Request,8278433,24,21,43,53,78,1,442,0.00%,2378.9,650.5,15.49,1685733707,50,60 diff --git a/load-tests/h1c_h1c_passthrough/results/summary.csv b/load-tests/h1c_h1c_passthrough/results/summary.csv index 6d5c7f9bd1..46f3631181 100644 --- a/load-tests/h1c_h1c_passthrough/results/summary.csv +++ b/load-tests/h1c_h1c_passthrough/results/summary.csv @@ -328,3 +328,5 @@ HTTP Request,11185587,16,12,35,47,76,0,350,0.00%,3214.3,571.3,15.40,1685305607,5 HTTP Request,10999720,17,12,36,47,77,0,594,0.00%,3160.9,561.8,15.72,1685392076,50,60 HTTP Request,9858732,18,14,40,52,86,0,537,0.00%,2833.0,503.5,17.66,1685478401,50,60 HTTP Request,11379278,16,12,35,46,75,0,428,0.00%,3269.9,581.2,15.22,1685564821,50,60 +HTTP Request,11330698,16,12,35,46,75,0,347,0.00%,3256.0,578.7,15.36,1685651266,50,60 +HTTP Request,11344755,16,12,35,46,75,0,450,0.00%,3260.1,579.4,15.33,1685737678,50,60 diff --git a/load-tests/h1c_transformation/results/summary.csv b/load-tests/h1c_transformation/results/summary.csv index 6c6a7616ec..06ca84f59b 100644 --- a/load-tests/h1c_transformation/results/summary.csv +++ b/load-tests/h1c_transformation/results/summary.csv @@ -324,3 +324,5 @@ HTTP Request,8778498,22,20,40,48,68,1,285,0.00%,2522.6,532.1,13.48,1685309609,50 HTTP Request,8799393,22,20,40,48,68,0,283,0.00%,2528.6,533.4,13.44,1685396085,50,60 HTTP Request,8044813,24,22,43,52,74,1,292,0.00%,2311.8,487.6,14.66,1685482374,50,60 HTTP Request,9112240,22,19,39,46,66,0,409,0.00%,2618.5,552.3,13.02,1685568777,50,60 +HTTP Request,8840501,22,20,40,48,68,0,264,0.00%,2540.4,535.9,13.47,1685655252,50,60 +HTTP Request,8791114,22,20,40,48,70,0,375,0.00%,2526.2,532.9,14.10,1685741629,50,60 diff --git a/load-tests/h2_h1c_passthrough/results/summary.csv b/load-tests/h2_h1c_passthrough/results/summary.csv index a20ff41591..caf2a2a2dd 100644 --- a/load-tests/h2_h1c_passthrough/results/summary.csv +++ b/load-tests/h2_h1c_passthrough/results/summary.csv @@ -280,3 +280,5 @@ H2-H1C Passthrough,5857,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1685310515,0,1 H2-H1C Passthrough,5831,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1685396992,0,1 H2-H1C Passthrough,5848,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1685483314,0,1 H2-H1C Passthrough,5861,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1685569803,0,1 +H2-H1C Passthrough,5849,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1685656204,0,1 +H2-H1C Passthrough,5858,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1685742547,0,1 diff --git a/load-tests/interceptors_passthrough/results/summary.csv b/load-tests/interceptors_passthrough/results/summary.csv index ece69e0e6e..73c7026a24 100644 --- a/load-tests/interceptors_passthrough/results/summary.csv +++ b/load-tests/interceptors_passthrough/results/summary.csv @@ -31,3 +31,5 @@ Test Request,4595281,45,27,105,152,279,0,6214,1.82%,1320.5,140.6,56.21,168531444 Test Request,4628826,44,27,104,151,277,0,6959,1.87%,1330.2,141.8,55.65,1685400960,50,60 Test Request,4240938,48,29,112,163,298,0,1377,2.08%,1218.7,130.4,59.77,1685487251,50,60 Test Request,4748132,43,25,102,148,274,0,5815,1.68%,1364.4,144.9,55.10,1685573748,50,60 +Test Request,4797149,43,26,100,145,267,0,1277,1.89%,1378.5,147.0,53.72,1685660148,50,60 +Test Request,4646600,44,27,103,149,272,0,6660,1.71%,1335.3,141.8,54.94,1685746538,50,60 diff --git a/load-tests/observability_enabled/results/summary.csv b/load-tests/observability_enabled/results/summary.csv index cd3b526489..22ade3ee48 100644 --- a/load-tests/observability_enabled/results/summary.csv +++ b/load-tests/observability_enabled/results/summary.csv @@ -311,3 +311,5 @@ HTTP Request,13621321,14,5,38,61,125,0,685,0.00%,3914.2,584.8,25.32,1685318405,5 HTTP Request,14025510,14,5,37,59,123,0,730,0.00%,4030.4,602.2,25.01,1685404962,50,60 HTTP Request,12851823,15,6,39,63,128,0,698,0.00%,3693.1,551.8,26.00,1685491249,50,60 HTTP Request,14254814,13,5,36,59,125,0,1054,0.00%,4096.3,612.0,25.25,1685577733,50,60 +HTTP Request,14088546,14,5,37,60,126,0,813,0.00%,4048.5,604.9,25.50,1685664126,50,60 +HTTP Request,13861009,14,5,37,61,126,0,645,0.00%,3983.1,595.1,25.50,1685750537,50,60 diff --git a/load-tests/snowpeak_passthrough/results/summary.csv b/load-tests/snowpeak_passthrough/results/summary.csv index b30ad9f1d6..93ce9fc917 100644 --- a/load-tests/snowpeak_passthrough/results/summary.csv +++ b/load-tests/snowpeak_passthrough/results/summary.csv @@ -162,3 +162,5 @@ Retrieve Available Locations,5528607,36,20,82,92,118,0,779,0.00%,1588.6,153.6,33 Retrieve Available Locations,5569175,36,19,82,93,120,0,509,0.00%,1600.4,154.7,33.68,1685408944,50,60 Retrieve Available Locations,5280123,38,22,83,94,120,1,496,0.00%,1517.3,146.7,33.57,1685495206,50,60 Retrieve Available Locations,5719924,35,19,81,90,113,0,624,0.00%,1643.6,158.9,32.74,1685581682,50,60 +Retrieve Available Locations,5677009,36,19,82,92,125,0,529,0.00%,1631.3,157.7,33.85,1685668110,50,60 +Retrieve Available Locations,5870926,34,18,80,91,117,0,465,0.00%,1687.1,163.1,33.02,1685754476,50,60 diff --git a/native/src/main/java/io/ballerina/stdlib/http/api/HttpUtil.java b/native/src/main/java/io/ballerina/stdlib/http/api/HttpUtil.java index 4277c277b6..e4452d9610 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/api/HttpUtil.java +++ b/native/src/main/java/io/ballerina/stdlib/http/api/HttpUtil.java @@ -578,7 +578,10 @@ public static BError createHttpError(Throwable throwable) { IOUtils.getIOPackage()); return createHttpError("Something wrong with the connection", HttpErrorType.GENERIC_CLIENT_ERROR, cause); } else if (throwable instanceof ClientConnectorException) { - return HttpUtil.createHttpStatusCodeError(CLIENT_CONNECTOR_ERROR, "Something wrong with the connection"); + cause = createErrorCause(throwable.getMessage(), IOConstants.ErrorCode.GenericError.errorCode(), + IOUtils.getIOPackage()); + return HttpUtil.createHttpStatusCodeError(CLIENT_CONNECTOR_ERROR, "Something wrong with the connection", + null, cause); } else if (throwable instanceof NullPointerException) { return createHttpError("Exception occurred: null", HttpErrorType.GENERIC_CLIENT_ERROR, createHttpError(throwable.toString())); diff --git a/native/src/main/java/io/ballerina/stdlib/http/api/service/signature/ParamUtils.java b/native/src/main/java/io/ballerina/stdlib/http/api/service/signature/ParamUtils.java index 78e0aabb18..6ad7bf9acc 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/api/service/signature/ParamUtils.java +++ b/native/src/main/java/io/ballerina/stdlib/http/api/service/signature/ParamUtils.java @@ -19,6 +19,7 @@ package io.ballerina.stdlib.http.api.service.signature; import io.ballerina.runtime.api.PredefinedTypes; +import io.ballerina.runtime.api.TypeTags; import io.ballerina.runtime.api.creators.TypeCreator; import io.ballerina.runtime.api.creators.ValueCreator; import io.ballerina.runtime.api.types.ArrayType; @@ -214,9 +215,12 @@ public static boolean isFiniteType(Type type) { public static int getEffectiveTypeTag(Type type, Type originalType, String paramType) { Type referredType = TypeUtils.getReferredType(type); int referredTypeTag = referredType.getTag(); + if (TypeTags.isIntegerTypeTag(referredTypeTag)) { + return INT_TAG; + } else if (TypeTags.isStringTypeTag(referredTypeTag)) { + return STRING_TAG; + } switch (referredTypeTag) { - case STRING_TAG: - case INT_TAG: case FLOAT_TAG: case BOOLEAN_TAG: case DECIMAL_TAG: