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

REST API with raw parameter returns nothing when payload is not UTF-8 encodable #1711

Open
ohowe1 opened this issue Jan 14, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@ohowe1
Copy link

ohowe1 commented Jan 14, 2025

Describe the bug

Hi! When calling the REST API to query a node that returns data that cannot be encoded into a UTF-8 string, the REST API returns nothing to the caller. I think it would be expected to return the raw payload, especially when the encoding on Zenoh and the Content-Type are not set to text, or at least to return an error.

This looks to be because the try_to_string is called on the payload bytes here.

Ok(sample) => response(
StatusCode::Ok,
Cow::from(sample.encoding()).as_ref(),
&sample.payload().try_to_string().unwrap_or_default(),
),

To reproduce

  1. Start a Zenoh node that responds to some query with non-utf-8 encodable data (ie protobuf)
  2. Start the Zenoh router
  3. Query through the REST API with the _raw parameter
  4. See nothing returned

System info

  • Zenoh v1.1.0
@ohowe1 ohowe1 added the bug Something isn't working label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant