app: raise a clear exception when request arguments fail to parse
This error is an indication that a JSON body was sent without the content type set to "application/json". Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
4de33bae4a
commit
13ccdb4df1
|
@ -297,7 +297,12 @@ class DynamicRequestHandler(AuthorizedRequestHandler):
|
||||||
return {'objects': args}
|
return {'objects': args}
|
||||||
|
|
||||||
def parse_args(self):
|
def parse_args(self):
|
||||||
args = self._parse_query()
|
try:
|
||||||
|
args = self._parse_query()
|
||||||
|
except Exception:
|
||||||
|
raise ServerError(
|
||||||
|
"Error Parsing Request Arguments. "
|
||||||
|
"Is the Content-Type correct?")
|
||||||
content_type = self.request.headers.get('Content-Type', "").strip()
|
content_type = self.request.headers.get('Content-Type', "").strip()
|
||||||
if content_type.startswith("application/json"):
|
if content_type.startswith("application/json"):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue