Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ and this project adheres to

- [#5222](https://github.com/firecracker-microvm/firecracker/pull/5222): Fixed
network and rng devices locking up on hosts with non 4K pages.
- [#5226](https://github.com/firecracker-microvm/firecracker/pull/5226): Fixed
MMDS to set `Content-Type` header correctly (i.e. `Content-Type: text/plain`
for IMDS-formatted or error responses and `Content-Type: application/json` for
JSON-formatted responses).

## [1.12.0]

Expand Down
15 changes: 14 additions & 1 deletion src/vmm/src/mmds/data_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ mod tests {
],
"member": false,
"shares_percentage": 12.12,
"balance": -24
"balance": -24,
"json_string": "{\n \"hello\": \"world\"\n}"
}"#;
let data_store: Value = serde_json::from_str(data).unwrap();
mmds.put_data(data_store).unwrap();
Expand Down Expand Up @@ -492,6 +493,18 @@ mod tests {
.to_string(),
MmdsDatastoreError::UnsupportedValueType.to_string()
);

// Retrieve a string including escapes.
assert_eq!(
mmds.get_value("/json_string".to_string(), OutputFormat::Json)
.unwrap(),
r#""{\n \"hello\": \"world\"\n}""#
);
assert_eq!(
mmds.get_value("/json_string".to_string(), OutputFormat::Imds)
.unwrap(),
"{\n \"hello\": \"world\"\n}"
)
}

#[test]
Expand Down
Loading