Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
Signed-off-by: gabrik <[email protected]>
  • Loading branch information
gabrik committed Mar 14, 2024
1 parent 280e9b7 commit 56ddcb4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/zenoh-plugin-rest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ pub fn base64_encode(data: &[u8]) -> String {
}

fn payload_to_json(payload: Payload, encoding: &Encoding) -> serde_json::Value {
match payload.len() {
match payload.is_empty() {
// If the value is empty return a JSON null
0 => serde_json::Value::Null,
true => serde_json::Value::Null,
// if it is not check the encoding
_ => {
false => {
match encoding {
// If it is a JSON try to deserialize as json, if it fails fallback to base64
&Encoding::APPLICATION_JSON | &Encoding::TEXT_JSON | &Encoding::TEXT_JSON5 => {
Expand Down

0 comments on commit 56ddcb4

Please sign in to comment.