Remove query string from uri when empty

Fixes #64

When `URI.query` is an empty string `URI.to_s` will leave a trailing
question mark, the true "emptiness" for query string is obtained with
`nil`