Skip to content

Commit

Permalink
Merge pull request #2200 from warunalakshitha/sync_master
Browse files Browse the repository at this point in the history
Sync with latest master
  • Loading branch information
warunalakshitha authored Oct 22, 2024
2 parents bb91312 + a25d5ed commit 67b6515
Show file tree
Hide file tree
Showing 39 changed files with 132 additions and 67 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-with-bal-test-graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ on:
- 2201.7.x
- 2201.8.x
- 2201.9.x
- java21
types: [opened, synchronize, reopened, labeled, unlabeled]

concurrency:
Expand Down
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.12.1"
version = "2.13.0"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.12.1"
version = "2.13.0"

[platform.java21]
graalvmCompatible = true

[[platform.java21.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.12.1-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.13.0-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 @@ -71,7 +71,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -104,7 +104,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_advanced_tests"
version = "2.12.1"
version = "2.13.0"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "file"},
Expand All @@ -124,7 +124,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "http"},
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.12.1"
version = "2.13.0"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.12.1"
version = "2.13.0"

[platform.java21]
graalvmCompatible = true

[[platform.java21.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.12.1-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.13.0-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 @@ -68,7 +68,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -101,7 +101,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_client_tests"
version = "2.12.1"
version = "2.13.0"
dependencies = [
{org = "ballerina", name = "constraint"},
{org = "ballerina", name = "http"},
Expand All @@ -120,7 +120,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "http"},
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.12.1"
version = "2.13.0"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.12.1"
version = "2.13.0"

[platform.java21]
graalvmCompatible = true

[[platform.java21.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.12.1-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.13.0-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 @@ -68,7 +68,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -101,7 +101,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_dispatching_tests"
version = "2.12.1"
version = "2.13.0"
dependencies = [
{org = "ballerina", name = "constraint"},
{org = "ballerina", name = "http"},
Expand All @@ -123,7 +123,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "http"},
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.12.1"
version = "2.13.0"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.12.1"
version = "2.13.0"

[platform.java21]
graalvmCompatible = true

[[platform.java21.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.12.1-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.13.0-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 @@ -65,7 +65,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -98,7 +98,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_interceptor_tests"
version = "2.12.1"
version = "2.13.0"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "http_test_common"},
Expand All @@ -114,7 +114,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "http"},
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.12.1"
version = "2.13.0"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.12.1"
version = "2.13.0"

[platform.java21]
graalvmCompatible = true

[[platform.java21.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.12.1-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.13.0-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 @@ -65,7 +65,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -98,7 +98,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_misc_tests"
version = "2.12.1"
version = "2.13.0"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "http_test_common"},
Expand All @@ -117,7 +117,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "http"},
Expand Down
22 changes: 22 additions & 0 deletions ballerina-tests/http-misc-tests/tests/http_header_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerina/mime;
import ballerina/test;
import ballerina/http;
import ballerina/http_test_common as common;
Expand Down Expand Up @@ -276,6 +277,27 @@ function testPassthruWithBody() returns error? {
}
}

@test:Config {}
function testAddHeaderWithContentType() returns error? {
http:Request req = new;
check req.setContentType(mime:APPLICATION_JSON);
test:assertEquals(check req.getHeaders(http:CONTENT_TYPE), [mime:APPLICATION_JSON]);
req.addHeader(http:CONTENT_TYPE, mime:APPLICATION_XML);
test:assertEquals(check req.getHeaders(http:CONTENT_TYPE), [mime:APPLICATION_XML]);

http:Response res = new;
check res.setContentType(mime:APPLICATION_JSON);
test:assertEquals(check res.getHeaders(http:CONTENT_TYPE), [mime:APPLICATION_JSON]);
res.addHeader(http:CONTENT_TYPE, mime:APPLICATION_XML);
test:assertEquals(check res.getHeaders(http:CONTENT_TYPE), [mime:APPLICATION_XML]);

http:PushPromise pushPromise = new;
pushPromise.addHeader(http:CONTENT_TYPE, mime:APPLICATION_JSON);
test:assertEquals(pushPromise.getHeaders(http:CONTENT_TYPE), [mime:APPLICATION_JSON]);
pushPromise.addHeader(http:CONTENT_TYPE, mime:APPLICATION_XML);
test:assertEquals(pushPromise.getHeaders(http:CONTENT_TYPE), [mime:APPLICATION_XML]);
}

type Headers record {|
@http:Header {name: "X-API-VERSION"}
string apiVersion;
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.12.1"
version = "2.13.0"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.12.1"
version = "2.13.0"

[platform.java21]
graalvmCompatible = true

[[platform.java21.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.12.1-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.13.0-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 @@ -65,7 +65,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -98,7 +98,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_resiliency_tests"
version = "2.12.1"
version = "2.13.0"
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.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "http"},
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.12.1"
version = "2.13.0"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.12.1"
version = "2.13.0"

[platform.java21]
graalvmCompatible = true

[[platform.java21.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.12.1-SNAPSHOT.jar"
path = "../../test-utils/build/libs/http-test-utils-2.13.0-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 @@ -68,7 +68,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -101,7 +101,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_security_tests"
version = "2.12.1"
version = "2.13.0"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "http"},
Expand All @@ -119,7 +119,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.12.1"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "http"},
Expand Down
Loading

0 comments on commit 67b6515

Please sign in to comment.