CenterForOpenScience / aiohttpretty

A simple asyncio compatible httpretty mock using aiohttp
12 stars 11 forks source link

Fix parameter-handling logic in ImmutableFurl #2

Closed felliott closed 9 years ago

felliott commented 9 years ago

ImmutableFurl's constructor has a couple of bugs with how it handles query parameters. Query params come from two places, they can be part of the passed-in url (implicit) and they can be passed as a kwarg (explicit). The implicit params were being discarded before being saved, and the explicit params were not being added due to a surprisingly-named utility method. This PR makes sure to save the implicit params before stripping them off the base url, and manually adds the explicit params to the saved params dict.

We also had been omitting explicit params when building new ImmutableFurls in register_uri and fake_request. This hadn't been triggering errors, since the explicit params were discarded anyway, and our consuming code didn't require them.