comparison 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
comparison
equal deleted inserted replaced
6507:bc95f7431efb 6509:1fc765ef6379
2050 # version? This may be a good thing to require. Note that: 2050 # version? This may be a good thing to require. Note that:
2051 # Accept: application/json; version=1 may not be legal but.... 2051 # Accept: application/json; version=1 may not be legal but....
2052 # Use default if not specified for now. 2052 # Use default if not specified for now.
2053 self.api_version = self.__default_api_version 2053 self.api_version = self.__default_api_version
2054 elif self.api_version not in self.__supported_api_versions: 2054 elif self.api_version not in self.__supported_api_versions:
2055 raise UsageError(msg % self.api_version) 2055 output = self.error_obj(400, msg % self.api_version)
2056 2056
2057 # sadly del doesn't work on FieldStorage which can be the type of 2057 # sadly del doesn't work on FieldStorage which can be the type of
2058 # input. So we have to ignore keys starting with @ at other 2058 # input. So we have to ignore keys starting with @ at other
2059 # places in the code. 2059 # places in the code.
2060 # else: 2060 # else:

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