Skip to content

Commit 7711048

Browse files
authored
Differentiate between missing and empty headers. (#305)
The method get_http_request_headers_bytes returns empty Vec for empty header value, but get_http_request_header_bytes returns None for empty header value. This commit intends to fix this inconsistency. Also added the same fix in get_map_value for get_http_request_header method. Signed-off-by: prembhaskal <[email protected]>
1 parent 8da6c5f commit 7711048

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hostcalls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ pub fn get_map_value(map_type: MapType, key: &str) -> Result<Option<String>, Sta
241241
.unwrap(),
242242
))
243243
} else {
244-
Ok(None)
244+
Ok(Some(String::new()))
245245
}
246246
}
247247
Status::NotFound => Ok(None),
@@ -269,7 +269,7 @@ pub fn get_map_value_bytes(map_type: MapType, key: &str) -> Result<Option<Bytes>
269269
return_size,
270270
)))
271271
} else {
272-
Ok(None)
272+
Ok(Some(Vec::new()))
273273
}
274274
}
275275
Status::NotFound => Ok(None),

0 commit comments

Comments
 (0)