You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
staticstringunexpectedBodyTypeForBundle(Bundle.RequestComponent rc)=>$"Operation {rc.Method} on {rc.Url}"+
To Reproduce
Steps to reproduce the behavior:
This could be reproduced in unit tests by returning a different resource type than requested.
Execute a search request that should return a bundle, for example on the Practitioner endpoint.
Mock the IFhirSerializationEngine and have it return a resource type of ImagingStudy (for example)
The above code will throw: FhirOperationException : Operation GET on <URL HERE> expected a body of type Bundle but a Bundle was returned.
Expected behavior
The message in the exception should indicate the unexpected resource type:
The above code will throw: FhirOperationException : Operation GET on <URL HERE> expected a body of type Practitioner but a ImagingStudy was returned.
Note: I am assuming the message here was to indicate the types of resources within the bundle entries...
Version used:
FHIR Version: R4
Version: 5.7.0
The text was updated successfully, but these errors were encountered:
Ha, this is not going to be very informative indeed: $"expected a body of type {typeof(TResource).Name} but a {typeof(TResource).Name} was returned.";, that's twice typeof(TResource).Name. Thanks for spotting it!
It will become "Operation GET......expected a body type of Bundle, but a ImagingStudy was returned". We don't really interpret the search string to figure out what kind of search results should be in the Bundle. And by the way, because of the _include feature, the Bundle could contain other types of resources than the one you are searching for
!
When doing a Http request, if the bundle returns an unexpected body type, the error message is incorrect.
Please see lines 909 and 912 of
BaseFhirClient
.firely-net-sdk/src/Hl7.Fhir.Base/Rest/BaseFhirClient.cs
Line 909 in dc32002
To Reproduce
Steps to reproduce the behavior:
This could be reproduced in unit tests by returning a different resource type than requested.
IFhirSerializationEngine
and have it return a resource type ofImagingStudy
(for example)FhirOperationException : Operation GET on <URL HERE> expected a body of type Bundle but a Bundle was returned.
Expected behavior
The message in the exception should indicate the unexpected resource type:
The above code will throw:
FhirOperationException : Operation GET on <URL HERE> expected a body of type Practitioner but a ImagingStudy was returned.
Note: I am assuming the message here was to indicate the types of resources within the bundle entries...
Version used:
The text was updated successfully, but these errors were encountered: