Skip to content

Commit 6f59f31

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

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

healthcare/fhir/patchFhirResource.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function main(
3131
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
3232
}),
3333
headers: {'Content-Type': 'application/json-patch+json'},
34+
responseType: 'json',
3435
});
3536

3637
async function patchFhirResource() {
@@ -50,8 +51,19 @@ function main(
5051
requestBody: patchOptions,
5152
};
5253

53-
await healthcare.projects.locations.datasets.fhirStores.fhir.patch(request);
54-
console.log(`Patched ${resourceType} resource`);
54+
try {
55+
const resource =
56+
await healthcare.projects.locations.datasets.fhirStores.fhir.patch(
57+
request
58+
);
59+
console.log(`Patched ${resourceType} resource`);
60+
console.log(JSON.stringify(resource.data, null, 2));
61+
} catch (error) {
62+
console.error(
63+
`Error patching ${resourceType} resource:`,
64+
error.message || error
65+
);
66+
}
5567
}
5668

5769
patchFhirResource();

0 commit comments

Comments
 (0)