Use mw.Uri to parse query instead of parsing it with regex

This would solve the issue of passing encoded data to mw.api,
which then encode the data again.

Change-Id: I396c14578cc49c8cc10faf01ba83f46f2636cbf1