microsoft / microsoft/fhir-server
$export fails on Accept header from HttpClient
- Dominant language
- TSQL
- Stars
- 1.4k
- Forks
- 592
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 41
Description
**Describe the bug**
The dotnet (8) HttpClient insists on adding `; charset=utf-8` to the `Accept`-header of a request. This causes an error in the `$export` operation because [this line of code](https://github.com/microsoft/fhir-server/blob/480b5c822652e454d50c0f5964911b5ed70032b8/src/Microsoft.Health.Fhir.Api/Features/Filters/ValidateExportRequestFilterAttribute.cs#L62) checks if the accept header is exactly the same as `application/fhir+json`. I think this line should be changed to `StartsWith`.
**FHIR Version?**
R4
**Data provider?**
SQL Server
**To Reproduce**
Steps to reproduce the behavior:
1. Call the `$export` endpoint with a dotnet `HttpClient`
2. Watch it burn
**Expected behavior**
It should work
**Actual behavior**
```
Operation was unsuccessful because of a client error (BadRequest). OperationOutcome: Overall result: FAILURE (1 errors and 0 warnings)\r\n[ERROR] (no details)(further diagnostics: Value supplied for the \"Accept\" header is not supported.)\r\n.
```
Contributor guide
Research direction
Start in src/Microsoft.Health.Fhir.Api/Features/Filters/ValidateExportRequestFilterAttribute.cs at line 62, then reproduce the $export request with a .NET 8 HttpClient. Confirm that an Accept header containing the reported charset is accepted and that the export no longer returns BadRequest.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100