Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce DefaultStatusCodeResponse #2002

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

Conversation

TharmiganK
Copy link
Contributor

@TharmiganK TharmiganK commented May 13, 2024

Purpose

$Subject

Fixes: ballerina-platform/ballerina-library#6491

Examples

  • Client side:

    http:StatusCodeClient clientEP = check new("localhost:9090/api");
    OkAlbumArray|http:DefaultStatusCodeResponse|error res = clientEP->/albums;
    
    type DefaultErrorResponse record {|
        *http:DefaultStatusCodeResponse;
        DefaultErrorMessage body;
        DefaultHeaders headers;
    |};
    OkAlbumArray|DefaultErrorResponse|error res = clientEP->/albums;
  • Service side:

    resource function get default/[int statusCode]() returns http:DefaultStatusCodeResponse {
        if statusCode == 204 {
            return {status: new (204)};
        }
        return {
            body: "Default Response",
            status: new (statusCode)
        };
    }

Checklist

Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 79.66102% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 80.96%. Comparing base (9d0f1b0) to head (75e31ac).

Files Patch % Lines
...b/http/api/nativeimpl/ExternResponseProcessor.java 85.71% 8 Missing and 2 partials ⚠️
ballerina/http_client_endpoint.bal 76.19% 5 Missing ⚠️
ballerina/http_response.bal 61.53% 5 Missing ⚠️
...ttp/api/nativeimpl/StatusCodeBindingException.java 60.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2002      +/-   ##
============================================
+ Coverage     80.57%   80.96%   +0.38%     
- Complexity        0      562     +562     
============================================
  Files           353      390      +37     
  Lines         19869    21677    +1808     
  Branches       4633     5003     +370     
============================================
+ Hits          16010    17550    +1540     
- Misses         2986     3118     +132     
- Partials        873     1009     +136     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

dilanSachi
dilanSachi previously approved these changes May 15, 2024
Copy link
Contributor

@dilanSachi dilanSachi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a minor comment. LGTM

TharmiganK and others added 2 commits May 16, 2024 11:23
Co-authored-by: Dilan Sachintha Nayanajith <dilansachinthanos@gmail.com>
Copy link

sonarcloud bot commented May 16, 2024

Please retry analysis of this Pull-Request directly on SonarCloud

dilanSachi
dilanSachi previously approved these changes May 17, 2024
TharmiganK and others added 5 commits May 28, 2024 10:22
…t-status-res

# Conflicts:
#	ballerina-tests/http-advanced-tests/Ballerina.toml
#	ballerina-tests/http-client-tests/Ballerina.toml
#	ballerina-tests/http-dispatching-tests/Ballerina.toml
#	ballerina-tests/http-interceptor-tests/Ballerina.toml
#	ballerina-tests/http-misc-tests/Ballerina.toml
#	ballerina-tests/http-resiliency-tests/Ballerina.toml
#	ballerina-tests/http-security-tests/Ballerina.toml
#	ballerina-tests/http-service-tests/Ballerina.toml
#	ballerina-tests/http2-tests/Ballerina.toml
#	ballerina/Ballerina.toml
#	ballerina/CompilerPlugin.toml
#	changelog.md
Copy link

sonarcloud bot commented May 30, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants