this fix implements usage of uri.query if it exists

Hello, esteemed quark-zju. We use this fix of your initial gem in our project. I think it would be great to have this fix also in the gem. Thanks