hibri / HttpMock

A library for creating Http servers on the fly in tests and stubbing responses
MIT License
128 stars 44 forks source link

Duplicate query parameters not supported #38

Closed neoistheone123 closed 8 years ago

neoistheone123 commented 8 years ago

When I use withParams(queryParams), the duplicate query parameter overrides the original query parameter. I would like to have something like ?date=123&date=678. Is there an elegant work-around?

hibri commented 8 years ago

Hi @ykeysergit,

Not at the moment. The query string is parsed into a Dictionary, https://github.com/hibri/HttpMock/blob/master/src/HttpMock/EndpointMatchingRule.cs#L51

Will think of something over the weekend. Happy to accept a PR too.

What is your test scenario ?

neoistheone123 commented 8 years ago

Test scenario: ?date=gt2016-06-12&date=le2016-06-13

I was able to use url-constraint as a work-around, but addQueryParameter is much more elegant :) URI spec doesn't restrict dup query string params as far as I'm aware, so maybe addQueryParameter should be modified? Thanks for looking into it!

hibri commented 8 years ago

@ykeysergit Thanks. I'll consider this for the next release.