Mediatype parameters

* merged with upstream `master` (just to be up-to-date).
* replaced a regex with a function call.