New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError WSGI response header value u'...' is not of type str #923
Comments
The strange chrome error comes from cherrypy not updating the content-type header after replacing the response content. Perhaps we should report that to cherrypy as well. I'll release a fix for the bottle-side of this bug soon. |
Fix #923: TypeError WSGI response header value u'...' is not of type str
That was quick ! Thanks for your prompt action. |
I'm not sure this is really a cherrypy bug. It might be caused by the "last resort" error handling in bottle. On first glance I cannot find a bug. https://github.com/bottlepy/bottle/blob/release-0.12/bottle.py#L973 looks fine (no Content-Length header at all). |
I guess to prove that we should reproduce it with a minimal test code as they did here: cherrypy/cherrypy#1530 ? |
0.12.12 and 0.12.13 are both bugfix releases, fixing issues introduced in 0.12.11: bottlepy/bottle#918 bottlepy/bottle#923 Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
The fix for #913 introduced new type checks on headers which causes failure when existing code like this:
is run with python 2.7
This used to work, now it shows this error in chromium:
The actual trace as shown in the console where the script runs is:
The workaround is to pass a string not a unicode string as mimetype:
At a minimum, it would be preferable to see the
"Critical error while processing request"
error not the"The requested resource returned more bytes than the declared Content-Length."
one which is misleading.For maximum backward compatibility, and if that does not cause side-effects, it would be nice if unicode strings would be OK as they used to be.
The text was updated successfully, but these errors were encountered: