You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi,
I am checking content type in middleware, and if it is not application/json, I raise HTTPUnsupportedMediaType exception.
Body template for HTTPUnsupportedMediaType:
body_template_obj = Template('''\
The request media type ${CONTENT_TYPE} is not supported by this server.
<br /><br />
${detail}''')
Traceback:
Traceback (most recent call last):
File "/project/common/middleware/common.py", line 91, in handle_errors
return req.get_response(app)
File "/project/venv/lib/python2.7/site-packages/webob/request.py", line 1327, in send
application, catch_exc_info=False)
File "/project/venv/lib/python2.7/site-packages/webob/request.py", line 1291, in call_application
app_iter = application(self.environ, start_response)
File "/project/venv/lib/python2.7/site-packages/webob/dec.py", line 145, in __call__
return resp(environ, start_response)
File "/project/venv/lib/python2.7/site-packages/webob/dec.py", line 131, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/project/venv/lib/python2.7/site-packages/webob/dec.py", line 196, in call_func
return self.func(req, *args, **kwargs)
File "/project/common/middleware/common.py", line 123, in sqlalchemy_sessions
res = req.get_response(app)
File "/project/venv/lib/python2.7/site-packages/webob/request.py", line 1327, in send
application, catch_exc_info=False)
File "/project/venv/lib/python2.7/site-packages/webob/request.py", line 1291, in call_application
app_iter = application(self.environ, start_response)
File "/project/venv/lib/python2.7/site-packages/webob/dec.py", line 145, in __call__
return resp(environ, start_response)
File "/project/venv/lib/python2.7/site-packages/webob/dec.py", line 145, in __call__
return resp(environ, start_response)
File "/project/venv/lib/python2.7/site-packages/webob/dec.py", line 145, in __call__
return resp(environ, start_response)
File "/project/venv/lib/python2.7/site-packages/webob/dec.py", line 145, in __call__
return resp(environ, start_response)
File "/project/venv/lib/python2.7/site-packages/webob/exc.py", line 359, in __call__
app_iter = self.generate_response(environ, start_response)
File "/project/venv/lib/python2.7/site-packages/webob/exc.py", line 339, in generate_response
body = self.html_body(environ)
File "/project/venv/lib/python2.7/site-packages/webob/exc.py", line 314, in html_body
body = self._make_body(environ, html_escape)
File "/project/venv/lib/python2.7/site-packages/webob/exc.py", line 304, in _make_body
return t_obj.substitute(args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/string.py", line 176, in substitute
return self.pattern.sub(convert, self.template)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/string.py", line 166, in convert
val = mapping[named]
KeyError: 'CONTENT_TYPE'
Is that expected and I should not raise that Exception if content type is not set?
The text was updated successfully, but these errors were encountered:
hi,
I am checking content type in middleware, and if it is not
application/json
, I raiseHTTPUnsupportedMediaType
exception.Body template for
HTTPUnsupportedMediaType
:Traceback:
Is that expected and I should not raise that Exception if content type is not set?
The text was updated successfully, but these errors were encountered: