Remove query string from uri when empty

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`
Merge pull request #103 from gabrielelana/issue-64

Remove query string from uri when empty