diff options
author | Vincent Ambo <tazjin@gmail.com> | 2018-06-17T13·18+0200 |
---|---|---|
committer | Vincent Ambo <github@tazj.in> | 2018-06-17T13·46+0200 |
commit | 05fa4769290f7b6d493d6a8a11ae8cda4f9bba49 (patch) | |
tree | bc99913727222f0dd50ba06c817cced15c9f08be | |
parent | 68189d4872fcd2f9ba23c168a534b8bce2f26bb5 (diff) |
fix(main): Correct name of JSON payload field
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/tests.rs | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 7a032f98f3e9..680eb0657ba1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -148,7 +148,7 @@ enum Payload { text_payload: String, }, JsonPayload { - #[serde(rename = "jsonPaylaod")] + #[serde(rename = "jsonPayload")] json_payload: Value, }, } diff --git a/src/tests.rs b/src/tests.rs index 6840602eca55..1547855299bf 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -22,15 +22,17 @@ fn test_json_entry_serialization() { let entry = LogEntry { labels: Value::Null, timestamp: None, - payload: Payload::TextPayload { - text_payload: "test entry".into(), + payload: Payload::JsonPayload { + json_payload: json!({ + "message": "JSON test" + }) } }; - let expected = "{\"labels\":null,\"textPayload\":\"test entry\"}"; + let expected = "{\"labels\":null,\"jsonPayload\":{\"message\":\"JSON test\"}}"; let result = to_string(&entry).expect("serialization failed"); - assert_eq!(expected, result, "Plain text payload should serialize correctly") + assert_eq!(expected, result, "JSOn payload should serialize correctly") } #[test] |