Skip to content

Commit aedc47e

Browse files
committed
fix(healthcare): set responseType to JSON instead of Buffer
1 parent 9d8a04c commit aedc47e

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

healthcare/fhir/deleteFhirResourcePurge.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const main = (
2929
auth: new google.auth.GoogleAuth({
3030
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
3131
}),
32+
responseType: 'blob',
3233
});
3334

3435
const deleteFhirResourcePurge = async () => {
@@ -42,10 +43,14 @@ const main = (
4243
const name = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/fhirStores/${fhirStoreId}/fhir/${resourceType}/${resourceId}`;
4344
const request = {name};
4445

45-
await healthcare.projects.locations.datasets.fhirStores.fhir.ResourcePurge(
46-
request
47-
);
48-
console.log('Deleted all historical versions of resource');
46+
try {
47+
await healthcare.projects.locations.datasets.fhirStores.fhir.ResourcePurge(
48+
request
49+
);
50+
console.log(`Purged all historical versions of resource: ${resourceId}`);
51+
} catch (error) {
52+
console.error('Error purging FHIR resource:', error.message || error);
53+
}
4954
};
5055

5156
deleteFhirResourcePurge();

healthcare/fhir/system-test/fhir_resources.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ it('should purge all historical versions of a FHIR resource', () => {
163163
{cwd}
164164
);
165165
assert.strictEqual(
166-
new RegExp('Deleted all historical versions of resource').test(output),
166+
new RegExp(
167+
`Purged all historical versions of resource: ${resourceId}`
168+
).test(output),
167169
true
168170
);
169171
});

0 commit comments

Comments
 (0)