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

Return partial String response even for invalid utf-8 #35

Closed
Arnavion opened this issue Mar 5, 2019 · 0 comments
Closed

Return partial String response even for invalid utf-8 #35

Arnavion opened this issue Mar 5, 2019 · 0 comments

Comments

@Arnavion
Copy link
Owner

Arnavion commented Mar 5, 2019

Currently the generated code for String responses (Pod::read_namespaced_pod_log, etc) returns Ok(&buf[..valid_up_to]) in case of truncated utf-8, but Err in the case of invalid utf-8 anywhere in the buffer.

However, it's useful to return Ok(&buf[..valid_up_to]) even in the case of invalid utf-8, and only return the Err if valid_up_to is 0. This way the caller gets as much of the parsed response as possible, rather than a variable amount depending on how they happened to chunk their response buffer.

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

No branches or pull requests

1 participant