diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c732ff..8f588fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.11.5 + +- Default `empty` value in fields must be quoted to be valid string field value. + ## v0.11.4 - Handle empty strings in tag/field values diff --git a/lib/fluxter/packet.ex b/lib/fluxter/packet.ex index 30fb4c9..f348acf 100644 --- a/lib/fluxter/packet.ex +++ b/lib/fluxter/packet.ex @@ -76,7 +76,7 @@ defmodule Fluxter.Packet do val |> String.trim() |> case do - "" -> "empty" + "" -> "\"empty\"" other -> [?\", escape(other, '"'), ?\"] end diff --git a/test/fluxter_test.exs b/test/fluxter_test.exs index 1be61c4..940668a 100644 --- a/test/fluxter_test.exs +++ b/test/fluxter_test.exs @@ -170,12 +170,12 @@ defmodule FluxterTest do test "empty string field" do TestFluxter.write("foo", "") - assert_receive {:echo, "foo value=empty"} + assert_receive {:echo, "foo value=\"empty\""} end test "only spaces in field" do TestFluxter.write("foo", " ") - assert_receive {:echo, "foo value=empty"} + assert_receive {:echo, "foo value=\"empty\""} end test "atom field" do