Split charset encoding form content-type
When interfacing interfacing with piston from a web-app, I kept getting bad request responses but couldn't understand why.
It turned out that piston wasn't separating out the content-type and the charset when it was getting a Content-Type like this:
I updated Mimer.content_type() as follows to deal with the problem. If you need a branch let me know, but just wanted to report this quickly!
def content_type(self): """ Returns the content type of the request in all cases where it is different than a submitted form - application/x-www-form-urlencoded """ type_formencoded = "application/x-www-form-urlencoded" # added the .split(";") to strip out any charset specifier that might accompany the encoding. # I was getting requests through as "application/x-www-form-urlencoded; charset=utf-8" # that piston did not recognise as forms. But were. ctype = self.request.META.get('CONTENT_TYPE', type_formencoded).split(";") if ctype == type_formencoded: return None return ctype