Fixed UnicodeEncodeError when POST JSON via web interface; added test

Bug: in web UI, when POST'ing JSON data with non-latin1 (e.g. Russian) characters, `UnicodeEncodeError` is raised from line 337 of `request.py`:

    self._stream = BytesIO(self._data[self._CONTENT_PARAM].encode(HTTP_HEADER_ENCODING))

Also added unit test. It is ugly (sorry, I don't have enough knowledge of the framework to write a nice one), but it does cover the issue.