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

HTTP interceptor related improvements #1552

Merged
merged 23 commits into from
Apr 19, 2023
Merged

HTTP interceptor related improvements #1552

merged 23 commits into from
Apr 19, 2023

Conversation

TharmiganK
Copy link
Contributor

@TharmiganK TharmiganK commented Apr 11, 2023

Purpose

$Subject

Examples

  1. Allows configuring interceptor pipeline with a single interceptor :
listener http:Listener serverEP = new (9090, interceptors = new Interceptor1());

@http:ServiceConfig {
    interceptors: new Interceptor2()
}
service on serverEP {

    resource function get test() returns string? {
        return "Hello, World!";
    }
}
  1. Allows http:Request in the ResponseInterceptor and the ResponseErrorInterceptor :
service class ResponseInterceptorWithReq {
    *http:ResponseInterceptor;

    remote function interceptResponse(http:Request req, http:Response res, http:RequestContext ctx)
             returns http:NextService|error? {
         ...
    }
}

service class ResponseErrorInterceptorWithReq {
    *http:ResponseErrorInterceptor;

    remote function interceptResponseError(error err, http:Request req)
             returns http:NextService|error? {
         ...
    }
}

Checklist

# Conflicts:
#	ballerina-tests/http-advanced-tests/Dependencies.toml
#	ballerina-tests/http-client-tests/Dependencies.toml
#	ballerina-tests/http-dispatching-tests/Dependencies.toml
#	ballerina-tests/http-interceptor-tests/Dependencies.toml
#	ballerina-tests/http-misc-tests/Dependencies.toml
#	ballerina-tests/http-resiliency-tests/Dependencies.toml
#	ballerina-tests/http-security-tests/Dependencies.toml
#	ballerina-tests/http-service-tests/Dependencies.toml
#	ballerina-tests/http-test-common/Dependencies.toml
#	ballerina-tests/http2-tests/Dependencies.toml
#	ballerina/Dependencies.toml
@codecov
Copy link

codecov bot commented Apr 11, 2023

Codecov Report

Patch coverage: 90.41% and project coverage change: +0.03 🎉

Comparison is base (be96569) 81.57% compared to head (e81b25c) 81.61%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1552      +/-   ##
============================================
+ Coverage     81.57%   81.61%   +0.03%     
- Complexity      524      525       +1     
============================================
  Files           388      388              
  Lines         21064    21120      +56     
  Branches       4702     4711       +9     
============================================
+ Hits          17184    17238      +54     
  Misses         2899     2899              
- Partials        981      983       +2     
Impacted Files Coverage Δ
ballerina/http_annotation.bal 100.00% <ø> (ø)
...va/io/ballerina/stdlib/http/api/HttpConstants.java 100.00% <ø> (ø)
...b/http/api/HttpRequestInterceptorUnitCallback.java 88.65% <ø> (-0.12%) ⬇️
...stdlib/http/api/nativeimpl/connection/Respond.java 73.55% <50.00%> (-0.40%) ⬇️
...rina/stdlib/http/api/HttpCallableUnitCallback.java 85.71% <83.33%> (-0.61%) ⬇️
...http/compiler/HttpInterceptorServiceValidator.java 84.81% <85.71%> (-0.16%) ⬇️
...a/io/ballerina/stdlib/http/api/HttpDispatcher.java 84.61% <87.50%> (+0.08%) ⬆️
ballerina/http_service_endpoint.bal 89.18% <100.00%> (+0.30%) ⬆️
...rina/stdlib/http/compiler/HttpDiagnosticCodes.java 100.00% <100.00%> (ø)
...tdlib/http/api/BallerinaHTTPConnectorListener.java 83.52% <100.00%> (+0.09%) ⬆️
... and 7 more

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@TharmiganK TharmiganK marked this pull request as ready for review April 17, 2023 02:44
@TharmiganK TharmiganK merged commit e1b0375 into master Apr 19, 2023
@TharmiganK TharmiganK deleted the interceptor-fixes branch April 19, 2023 10:17
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.

Interceptors config always requires an array RequestContext does not include Request
3 participants