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

Support Returning Response Headers from FHIR Calls for Errors #190

Open
MichaelLeeHobbs opened this issue Aug 30, 2023 · 1 comment
Open

Comments

@MichaelLeeHobbs
Copy link

Expected Behavior

await client.search({resourceType, searchParams}) throws and should be able to call const { response, request } = Client.httpFor(err) to get the response.

Actual Behavior

response is undefined

Steps to Reproduce the Problem

        it('should search for Patient resources for zztest', async () => {
            try {
                const patients = await client.search({resourceType: 'Patient', searchParams: {family: 'zztest'}});
                console.log(patients);
                expect(patients).toBeDefined();
                expect(patients.resourceType).toBe('Bundle');
                expect(patients.entry.length).toBeGreaterThan(0);
            } catch (err) {
                console.error(JSON.stringify(err, null, 2));

                const { response, request } = Client.httpFor(err);
                console.log(response); // <======= undefined
                throw err;
            }
        }, 10000);

Specifications

  • Version: ^1.9.2
  • Platform: node v18.17.0
  • Subsystem: ? not sure what this is looking for

As a workaround I just added console.log('response.headers', headers); to line 173 of http-client.js. This is not a feature we normally need but Cerner is sending 422 and they needed the X-Request-Id to troubleshoot their side.

@bkaney
Copy link
Member

bkaney commented Aug 30, 2023

Okay, we will look into this thanks for the issue!

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