nebraska: Send responses in binary format

Seems like sending error responses in `str` fails. Sending in binary
format is requested.

BUG=None
TEST=unittests

Change-Id: I50f7d4802745b57c30120847195084f9e3277adc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2952948
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Vyshu Khota <vyshu@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/nebraska/nebraska.py b/nebraska/nebraska.py
index 382e7e3..8d2a61b 100755
--- a/nebraska/nebraska.py
+++ b/nebraska/nebraska.py
@@ -955,7 +955,7 @@
         data = self.rfile.read(request_len)
       except Exception as err:
         logging.error('Failed to read request in do_POST %s', str(err))
-        self.send_error(http.client.BAD_REQUEST, 'Invalid request (header).')
+        self.send_error(http.client.BAD_REQUEST, b'Invalid request (header).')
         return
 
       parsed_path, parsed_query = self._ParseURL(self.path)
@@ -972,7 +972,7 @@
 
         elif parsed_path == 'update_config':
           self.server.owner.nebraska.UpdateConfig(**json.loads(data))
-          self._SendResponse('text/plain', 'Config set!')
+          self._SendResponse('text/plain', b'Config set!')
 
         else:
           error_str = 'The requested path "%s" was not found!' % parsed_path
@@ -997,7 +997,7 @@
       parsed_path, _ = self._ParseURL(self.path)
 
       if parsed_path == 'health_check':
-        self._SendResponse('text/plain', 'Nebraska is alive!')
+        self._SendResponse('text/plain', b'Nebraska is alive!')
       else:
         logging.error('The requested path "%s" was not found!', parsed_path)
         self.send_error(http.client.BAD_REQUEST,
diff --git a/nebraska/nebraska_unittest.py b/nebraska/nebraska_unittest.py
index 28885b2..c573192 100755
--- a/nebraska/nebraska_unittest.py
+++ b/nebraska/nebraska_unittest.py
@@ -290,7 +290,7 @@
     self.assertTrue(
         nebraska_handler.server.owner.nebraska._config.critical_update)
     nebraska_handler._SendResponse.assert_called_once_with(
-        'text/plain', 'Config set!')
+        'text/plain', b'Config set!')
 
   def testDoGetFailureBadPath(self):
     """Tests do_GET failure on bad path."""
@@ -307,7 +307,7 @@
 
     nebraska_handler.do_GET()
     nebraska_handler._SendResponse.assert_called_once_with(
-        'text/plain', 'Nebraska is alive!')
+        'text/plain', b'Nebraska is alive!')
 
 class NebraskaServerTest(NebraskaBaseTest):
   """Test NebraskaServer."""