From f553c4e08f11c18ef03fdacfcfaaea4771a13b4e Mon Sep 17 00:00:00 2001
From: Matthias Endler <matthias.endler@trivago.com>
Date: Wed, 21 Sep 2016 22:55:36 +0200
Subject: Add support for boolean values

---
 src/ser/value.rs        |  4 ++--
 tests/test_serialize.rs | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/ser/value.rs b/src/ser/value.rs
index 7a2ac42..d017242 100644
--- a/src/ser/value.rs
+++ b/src/ser/value.rs
@@ -51,8 +51,8 @@ impl<'key, 'target, Target> Serializer
     type StructState = ();
     type StructVariantState = ();
 
-    fn serialize_bool(&mut self, _v: bool) -> Result<(), Error> {
-        Err(Error::unsupported_value())
+    fn serialize_bool(&mut self, v: bool) -> Result<(), Error> {
+        self.append_pair(if v { "true" } else { "false" })
     }
 
     fn serialize_isize(&mut self, v: isize) -> Result<(), Error> {
diff --git a/tests/test_serialize.rs b/tests/test_serialize.rs
index 20592fc..b401ef9 100644
--- a/tests/test_serialize.rs
+++ b/tests/test_serialize.rs
@@ -25,3 +25,27 @@ fn serialize_option_map_string() {
         serde_urlencoded::to_string(params),
         Ok("first=hello&last=world".to_owned()));
 }
+
+#[test]
+fn serialize_option_map_bool() {
+    let params = &[
+        ("one", Some(true)),
+        ("two", Some(false))
+    ];
+
+    assert_eq!(
+        serde_urlencoded::to_string(params),
+        Ok("one=true&two=false".to_owned()));
+}
+
+#[test]
+fn serialize_map_bool() {
+    let params = &[
+        ("one", true),
+        ("two", false)
+    ];
+
+    assert_eq!(
+        serde_urlencoded::to_string(params),
+        Ok("one=true&two=false".to_owned()));
+}
-- 
cgit v1.2.3