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

If-None-Match use cause exceptions and data loss or GTE #18

Open
bvdh opened this issue Nov 12, 2024 · 0 comments
Open

If-None-Match use cause exceptions and data loss or GTE #18

bvdh opened this issue Nov 12, 2024 · 0 comments

Comments

@bvdh
Copy link

bvdh commented Nov 12, 2024

When accessing FhirCandle from a browser I ran into the issue that the If-None-Match header is set.

Such behavior is supported (see https://www.hl7.org/fhir/http.html#cread).

This causes an error in creation of the response body as the dotnet library seams to have issues with adding a response body to a response with HttpStatusCode.NotModified. An empty response also is an issue for the application as it is expecting data and not getting any. I'm reading the data using fhirclient.js, not sure whether it can disable it.

The exception I'm getting is:

Connection id "0HN834R99BCFH", Request id "0HN834R99BCFH:00000001": An unhandled exception was thrown by the application.
System.InvalidOperationException: Writing to the response body is invalid for responses with status code 304.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.Advance(Int32 bytes)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponsePipeWriter.Advance(Int32 bytes)
at Microsoft.AspNetCore.Http.HttpResponseWritingExtensions.Write(HttpResponse response, String text, Encoding encoding)
at Microsoft.AspNetCore.Http.HttpResponseWritingExtensions.WriteAsync(HttpResponse response, String text, Encoding encoding, CancellationToken cancellationToken)
at fhir.candle.Controllers.FhirController.AddFhirResponse(HttpResponse response, String prefer, Boolean success, FhirResponseContext opResponse) in C:\Data\github-philips\fhir-dicom\src\DicomOnFhir.App.FhirCandle\Controllers\FhirController.cs:line 214
at fhir.candle.Controllers.FhirController.GetResourceInstance(String storeName, String resourceName, String id, String format, String summary, String pretty, String ifMatch, String ifModifiedSince, String ifNoneMatch, String authHeader) in C:\Data\github-philips\fhir-dicom\src\DicomOnFhir.App.FhirCandle\Controllers\FhirController.cs:line 449

Disabling this behavior by removing line 2034-2042 in VersionFhirStore,cs, disables this behavior and fixes the issue.

I suggest to make support of 'ifNoneMatch' optional (and return an empty response) and to add a configuration variable for it or to remove the functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant