handle duplicate keys

Handle duplicate keys correctly, e.g. the same way that the request module does it (should fix #1)
Thanks! I thought I looked that up - apparently I didn't.