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

Add common constants for HTTP status-code responses #1540

Closed
ayeshLK opened this issue Jun 25, 2021 · 0 comments · Fixed by ballerina-platform/module-ballerina-http#493 or ballerina-platform/module-ballerina-http#983
Assignees
Labels
module/http Team/PCM Protocol connector packages related issues Type/Improvement

Comments

@ayeshLK
Copy link
Member

ayeshLK commented Jun 25, 2021

Description:
Provide common reusable constants for HTTP status-code responses.

Sample Usage
Developer should be able to use common constants for HTTP status-codes when developing a HTTP service.

service / on new http:Listener(9090) {
    resource function 'default hello(http:Request request) returns http:Ok|http:BadRequest {
        error? validationResponse = validate(request);
        if validationResponse is error {
            return http:BAD_REQUEST;
        }

        // implement logic
        return http:OK;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/http Team/PCM Protocol connector packages related issues Type/Improvement
Projects
None yet
4 participants