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

resolveReferences does not propagate the request options #184

Closed
shauntan-synapxe opened this issue Jul 10, 2024 · 1 comment
Closed

resolveReferences does not propagate the request options #184

shauntan-synapxe opened this issue Jul 10, 2024 · 1 comment

Comments

@shauntan-synapxe
Copy link

Describe the bug
Our FHIR server is customized to require an additional request header for every request. When using client.request() we can do something like below:

    const fetchProps = {
      url: `${resourceType}/${resourceId}`,
      method: 'GET',
      headers: {
        'X-Custom-Header': 'someCustomKey',
      },
    };

    const response = await client.request(fetchProps, {
      resolveReferences: ['someReferences'],
    });

The initial call would be fine, however the subsequent call to resolve the references does not propagate the header.

To Reproduce
For example, I have an AllergyIntolerance record in my FHIR server which references to a Patient resource.

    const fetchProps = {
      url: `AllergyIntolerance/${resourceId}`,
      method: 'GET',
      headers: {
        'X-Custom-Header': 'someCustomKey',
      },
    };

    const response = await client.request(fetchProps, {
      resolveReferences: ['patient'],
    });

The FhirClient would GET the AllergyIntolerance record with the custom request header, it then follow-up with another GET to retrieve the referenced Patient record. However, the follow-up reference GET does not pass in the custom request header.

Expected behavior
Please propagate the request headers when performing additional fetch when resolving references.

Client-side (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Version 126.0.6478.127 (Official Build) (64-bit)
  • Front-end Framework(s): React

Server-side (please complete the following information):
Not relevant.

Additional context
N/A

@vlad-ignatov
Copy link
Collaborator

A fix is included in fhirclient@2.5.4. Feel free to reopen if it doesn't work. Thank you!

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

2 participants