Content negotiation

This PR will add a complete content negotiation, including mime type, charset and encoding.

Also, it shortens code related to mime types and removes duplications.