Update Url class for tests

* The logic used to implement method chaining was updated to deep-copy
  original object.
* A new function named `query` was added to implement query string.