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

Merged
merged 30 commits into from
Jun 3, 2024
Merged

Introduce DefaultStatusCodeResponse #2002

merged 30 commits into from
Jun 3, 2024

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.99%. Comparing base (c85e994) to head (ba35fb1).
Report is 1 commits behind head on master.

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.96%   80.99%   +0.02%     
  Complexity      562      562              
============================================
  Files           389      390       +1     
  Lines         21614    21677      +63     
  Branches       4979     5003      +24     
============================================
+ Hits          17500    17557      +57     
- Misses         3101     3107       +6     
  Partials       1013     1013              

☔ 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 6 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 Jun 3, 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

@TharmiganK TharmiganK merged commit 8c99700 into master Jun 3, 2024
7 of 8 checks passed
@TharmiganK TharmiganK deleted the default-status-res branch June 3, 2024 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce a DefaultStatusCodeResponse in the http module
4 participants