Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-ballerina-http into integrate-data.json

# Conflicts:
#	gradle.properties
  • Loading branch information
lnash94 committed Oct 29, 2024
2 parents 2e36e15 + 2267e56 commit c93ac98
Show file tree
Hide file tree
Showing 39 changed files with 180 additions and 79 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.java17]
graalvmCompatible = true

[[platform.java17.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"
8 changes: 4 additions & 4 deletions ballerina-tests/http-advanced-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,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 @@ -116,7 +116,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 @@ -136,7 +136,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 Expand Up @@ -299,7 +299,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "mime"
version = "2.10.0"
version = "2.10.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
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.java17]
graalvmCompatible = true

[[platform.java17.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"
8 changes: 4 additions & 4 deletions ballerina-tests/http-client-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,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 @@ -116,7 +116,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 = "data.jsondata"},
Expand All @@ -136,7 +136,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 Expand Up @@ -299,7 +299,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "mime"
version = "2.10.0"
version = "2.10.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
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.java17]
graalvmCompatible = true

[[platform.java17.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"
8 changes: 4 additions & 4 deletions ballerina-tests/http-dispatching-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,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 @@ -113,7 +113,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 @@ -135,7 +135,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 Expand Up @@ -334,7 +334,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "mime"
version = "2.10.0"
version = "2.10.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
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.java17]
graalvmCompatible = true

[[platform.java17.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"
8 changes: 4 additions & 4 deletions ballerina-tests/http-interceptor-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,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 @@ -110,7 +110,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 @@ -126,7 +126,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 Expand Up @@ -289,7 +289,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "mime"
version = "2.10.0"
version = "2.10.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
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.java17]
graalvmCompatible = true

[[platform.java17.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"
8 changes: 4 additions & 4 deletions ballerina-tests/http-misc-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,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 @@ -110,7 +110,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 @@ -129,7 +129,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 Expand Up @@ -295,7 +295,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "mime"
version = "2.10.0"
version = "2.10.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
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.java17]
graalvmCompatible = true

[[platform.java17.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"
8 changes: 4 additions & 4 deletions ballerina-tests/http-resiliency-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,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 @@ -110,7 +110,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 @@ -127,7 +127,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 Expand Up @@ -290,7 +290,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "mime"
version = "2.10.0"
version = "2.10.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
Expand Down
Loading

0 comments on commit c93ac98

Please sign in to comment.