Incorrect text/html header detection in the middleware
Opened this issue · 1 comments
bfontaine commented
Hello,
The middleware looks for a header Content-Type
whose value is exactly text/html
. However Flask’s default is text/html; charset=utf-8
. Using this middleware as-is in a Flask app thus doesn’t work.
bfontaine commented
Well even if I fix this the middleware still fails:
return [self.minifier.minify(*html)]
File "...-py3.9/lib/python3.9/site-packages/htmlmin/main.py", line 162, in minify
self.input(*input)
File "...-py3.9/lib/python3.9/site-packages/htmlmin/main.py", line 174, in input
self._parser.feed(i)
File "...-py3.9/lib/python3.9/site-packages/htmlmin/python3html/parser.py", line 124, in feed
self.rawdata = self.rawdata + data
TypeError: can only concatenate str (not "bytes") to str