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

[FEATURE] Track consumed params and content in RestRequest #49

Closed
dbwiddis opened this issue Sep 19, 2023 · 0 comments · Fixed by #76
Closed

[FEATURE] Track consumed params and content in RestRequest #49

dbwiddis opened this issue Sep 19, 2023 · 0 comments · Fixed by #76
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest Welcome Hacktoberfest participants!

Comments

@dbwiddis
Copy link
Member

dbwiddis commented Sep 19, 2023

Is your feature request related to a problem?

OpenSearch's RestRequest class tracks whether params and content are "consumed". The apparent motivation for this feature is to permit a "did you mean" capability if you have a typo in a param name.

For this to work properly, we need to track when a param is accessed

What solution would you like?

The "pythonic" equivalent of this Java code in the RestRequest class:
For params:

public final String param(String key) {
    consumedParams.add(key);
    return params.get(key);
}

For content:

public BytesReference content() {
    return content(true);
}

protected BytesReference content(final boolean contentConsumed) {
    this.contentConsumed = this.contentConsumed | contentConsumed;
    return httpRequest.content();
}

What alternatives have you considered?

Just consuming all the content and params, essentially disabling this feature.

Do you have any additional context?

Testing the existence of a param shouldn't consume it. Fetching its value causes this side effect.

@dbwiddis dbwiddis added enhancement New feature or request untriaged Issues that require attention from the maintainers. hacktoberfest Welcome Hacktoberfest participants! good first issue Good for newcomers and removed untriaged Issues that require attention from the maintainers. labels Sep 19, 2023
This was referenced Oct 27, 2023
@dbwiddis dbwiddis self-assigned this Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest Welcome Hacktoberfest participants!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant