Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FhirClient.SearchUsingPost() using multiple includes throws exception #1206

Closed
ChrisLurge opened this issue Jan 7, 2020 · 2 comments
Closed
Assignees
Labels

Comments

@ChrisLurge
Copy link

When adding more than one includes to the SearchParameter, the SearchUsingPost-Method
throws the exception: 'An item with the same key has already been added.', whereas the Search-Method
works fine. Also using the overloaded method, passing a string-array for the includes, failes
if the array contains more than one element.

Sample code:

`
var sp = new SearchParams();
sp.Parameters.Add(new Tuple<string, string>("_id", "8465,8479"));
sp.Include.Add("subject");

        client.Search<Procedure>(sp);
        // OK
        client.SearchUsingPost<Procedure>(sp);
        // OK

        // Add a further include
        sp.Include.Add("encounter");
        client.Search<Procedure>(sp);
        // OK

        client.SearchUsingPost<Procedure>(sp);
        // Exception! 'An item with the same key has already been added.'

`

I can't see an error in my code.

@marcovisserFurore
Copy link
Member

Thanks @ChrisLurge. This is indeed a bug. We use somewhere a dictionary for the parameters, which dictates that the parameters should be unique. Which should be the case. We will solve this.

Thanks for your feedback.

@marcovisserFurore
Copy link
Member

To the developer:
In EntryToHttpExtensions.setBodyAndContentType we use a Dictionary (bodyParameters) for building the parameterlist. This should be something that implements IEnumerable<KeyValuePair<string, string>>

@kennethmyhra kennethmyhra self-assigned this Jan 10, 2020
kennethmyhra added a commit that referenced this issue Jan 10, 2020
* Using IEnumerable<KeyValuePair<string, string>> instead of Dictionary
  in EntryToHttpExtensions.setBodyAndContentType
* Fixes #1206
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants