Re: POST JSON vs. urlencoded

Ralf Schlatterbeck <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
On Tue, Apr 02, 2019 at 06:12:39PM +0200, Ralf Schlatterbeck wrote:
> Until now I had tested POST to the REST API only with content-type
> application/x-www-form-urlencoded -- this works fine. Now I've started
> testing with application/json and I'm getting a traceback where a
> type-check on the id for a link fails in the rdbms backend with the
> message "link value must be String".

Looks like the standard FieldStorage returns strings, not unicode and
the strings are encoded in UTF-8. The SimulateFieldStorageFromJson
returns unicode, both for the name and value attributes.
(I'm still using python2)

At least in python2 roundup's database interface wants UTF-8 for all
strings. Can someone chime in and tell me if this has changed with
python3? I don't want to change this now and break py3 compatibility.
Unfortunately our REST tests currently don't seem to cover the different
encodings (they just call the rest methods directly).

Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   http://www.runtux.com
Reichergasse 131, A-3411 Weidling       email: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.