Skip to content

Commit

Permalink
Merge pull request #1800 from ballerina-platform/fix-url-encode
Browse files Browse the repository at this point in the history
Fix URL encoded form data binding
  • Loading branch information
TharmiganK authored Oct 24, 2023
2 parents e578062 + 1a39546 commit 52122f9
Show file tree
Hide file tree
Showing 26 changed files with 90 additions and 70 deletions.
6 changes: 3 additions & 3 deletions ballerina-tests/http-advanced-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_advanced_tests"
version = "2.10.3"
version = "2.10.4"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.3"
version = "2.10.4"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-advanced-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -105,7 +105,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_advanced_tests"
version = "2.10.3"
version = "2.10.4"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "file"},
Expand All @@ -125,7 +125,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-client-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_client_tests"
version = "2.10.3"
version = "2.10.4"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.3"
version = "2.10.4"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-client-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -102,7 +102,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_client_tests"
version = "2.10.3"
version = "2.10.4"
dependencies = [
{org = "ballerina", name = "constraint"},
{org = "ballerina", name = "http"},
Expand All @@ -121,7 +121,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-dispatching-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_dispatching_tests"
version = "2.10.3"
version = "2.10.4"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.3"
version = "2.10.4"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-dispatching-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -102,7 +102,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_dispatching_tests"
version = "2.10.3"
version = "2.10.4"
dependencies = [
{org = "ballerina", name = "constraint"},
{org = "ballerina", name = "http"},
Expand All @@ -124,7 +124,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ service /dataBinding on generalListener {
return "body11";
}

resource function post body12(map<string> form) returns map<string> {
return form;
}

resource function get negative1(http:Caller caller) returns error? {
lock {
var err = generalListener.attach(multipleAnnot1, "multipleAnnot1");
Expand Down Expand Up @@ -466,6 +470,18 @@ function testDataBindingWithMapOfString() {
}
}

@test:Config {}
function testDataBindingWithEncodedKeyValuePair() {
http:Request req = new;
req.setTextPayload("key0%261%3D2=value1&key2=value2%26value3%3Dvalue4", contentType = "application/x-www-form-urlencoded");
http:Response|error response = dataBindingClient->post("/dataBinding/body12", req);
if response is http:Response {
common:assertJsonPayload(response.getJsonPayload(), {"key0&1=2": "value1", "key2": "value2&value3=value4"});
} else {
test:assertFail(msg = "Found unexpected output type: " + response.message());
}
}

//Test data binding with map of string type
@test:Config {}
function testDataBindingWithMapOfStringNegative() {
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-interceptor-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_interceptor_tests"
version = "2.10.3"
version = "2.10.4"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.3"
version = "2.10.4"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-interceptor-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -99,7 +99,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_interceptor_tests"
version = "2.10.3"
version = "2.10.4"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "http_test_common"},
Expand All @@ -115,7 +115,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-misc-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_misc_tests"
version = "2.10.3"
version = "2.10.4"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.3"
version = "2.10.4"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-misc-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -99,7 +99,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_misc_tests"
version = "2.10.3"
version = "2.10.4"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "http_test_common"},
Expand All @@ -118,7 +118,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-resiliency-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_resiliency_tests"
version = "2.10.3"
version = "2.10.4"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.3"
version = "2.10.4"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-resiliency-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -99,7 +99,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_resiliency_tests"
version = "2.10.3"
version = "2.10.4"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "http_test_common"},
Expand All @@ -116,7 +116,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-security-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_security_tests"
version = "2.10.3"
version = "2.10.4"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.3"
version = "2.10.4"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-security-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -102,7 +102,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_security_tests"
version = "2.10.3"
version = "2.10.4"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "http"},
Expand All @@ -120,7 +120,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.3"
version = "2.10.4"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
7 changes: 3 additions & 4 deletions ballerina-tests/http-service-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
[package]
org = "ballerina"
name = "http_service_tests"
version = "2.10.3"
version = "2.10.4"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.3"
version = "2.10.4"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar"

path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar"
Loading

0 comments on commit 52122f9

Please sign in to comment.