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

Rename RequestContext add function to set #2414

Closed
chamil321 opened this issue Nov 22, 2021 · 1 comment
Closed

Rename RequestContext add function to set #2414

chamil321 opened this issue Nov 22, 2021 · 1 comment
Assignees
Labels
module/http Team/PCM Protocol connector packages related issues Type/Improvement

Comments

@chamil321
Copy link
Contributor

Description:

public isolated class RequestContext {
    private final map<value:Cloneable|isolated object {}> attributes = {};

    public isolated function add(string 'key, value:Cloneable|isolated object {} value) {
        if value is value:Cloneable {
            lock {
                self.attributes['key] = value.clone();
            }
        }
        else {
            lock {
                self.attributes['key] = value;
            }   
        }
    }

    public isolated function get(string 'key) returns value:Cloneable|isolated object {} {
        lock {
            return self.attributes.get('key);
        }
    }

    public isolated function remove(string 'key) {
        lock {
            value:Cloneable|isolated object {} _ = self.attributes.remove('key);
        }
    }

    public isolated function next() returns RequestInterceptor|ResponseInterceptor|HttpService|error? = external;
}

Describe your problem(s)

Describe your solution(s)

Related Issues (optional):

Suggested Labels (optional):

Suggested Assignees (optional):

@chamil321 chamil321 added Type/Improvement module/http Team/PCM Protocol connector packages related issues and removed Type/Improvement labels Nov 22, 2021
@chamil321 chamil321 added this to the Ballerina Swan Lake - Beta5 milestone Nov 22, 2021
@chamil321
Copy link
Contributor Author

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
Development

No branches or pull requests

2 participants