fsprojects / FsHttp

A lightweight F# HTTP library by @SchlenkR and @dawedawe
https://fsprojects.github.io/FsHttp/
Apache License 2.0
424 stars 42 forks source link

Support Repeating Query Parameters #125

Closed DaveJohnson8080 closed 1 year ago

DaveJohnson8080 commented 1 year ago

additionalQueryParams has recently changed from List<string, string> to Map<string, obj>

Some systems are designed to accept repeating query parameters. Map effectively removes the duplicates which results in unexpected results after upgrading FsHttp in existing codebases.

Pretty straightforward to change it back to List<string, string> or List<string, obj>.

dawedawe commented 1 year ago

Hey @DaveJohnson8080, thanks a lot for your PR.

Just out of curiosity, could you name such a system? Is there some public API which works like that?

DaveJohnson8080 commented 1 year ago

Hey @DaveJohnson8080, thanks a lot for your PR.

Just out of curiosity, could you name such a system? Is there some public API which works like that?

Thanks for the quick response.

HL7 FHIR makes heavy use of query parameters that allow for creating things like date ranges by repeating a "date" query param with instructions. Such as...

.../Observation/subject=SomePatientID&date=ge2022-05-01&date=le2022-05-30 where... ge = "greater than or equal to" le = "less than or equal to"

translates to "where date greater than or equal to 2022-05-01 AND less than or equal to 2022-05-30".

https://www.hl7.org/fhir/search.html#combining

SchlenkR commented 1 year ago

I think we should support this, since it's a comon way for defining array-like query parameters (although it's not clearly defined in the RFC).

It's also supported in ASP.Net, where the query string is represented by IEnumerable<KeyValuePair<String,StringValues>>.

https://stackoverflow.com/questions/24059773/correct-way-to-pass-multiple-values-for-same-parameter-name-in-get-request

SchlenkR commented 1 year ago

Thank you @DaveJohnson8080 for the PR :)

DaveJohnson8080 commented 1 year ago

Thank you @DaveJohnson8080 for the PR :)

Thank you for this awesome library!