diff roundup/rest.py @ 6509:1fc765ef6379

Fix 204 responses, hangs and crashes with REST. Remove Content-Type and make sure no content is returned by OPTIONS request in REST interface. In write_html set the Content-Length when response is not encoded/compressed (fixes hang due to missing content-length with unencoded data). In REST interface do not raise UsageError for invalid api version. Return json error with proper message. Fixes crash.
author John Rouillard <rouilj@ieee.org>
date Sat, 16 Oct 2021 13:34:04 -0400
parents 66a061e52435
children d5a3fe9ac12d
line wrap: on
line diff
--- a/roundup/rest.py	Fri Oct 08 00:35:09 2021 -0400
+++ b/roundup/rest.py	Sat Oct 16 13:34:04 2021 -0400
@@ -2052,7 +2052,7 @@
             #    Use default if not specified for now.
             self.api_version = self.__default_api_version
         elif self.api_version not in self.__supported_api_versions:
-            raise UsageError(msg % self.api_version)
+            output = self.error_obj(400, msg % self.api_version)
 
         # sadly del doesn't work on FieldStorage which can be the type of
         # input. So we have to ignore keys starting with @ at other

Roundup Issue Tracker: http://roundup-tracker.org/