@nsshunt/stsfhirclient 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9251,7 +9251,7 @@ var FhirRESTClient = class {
9251
9251
  * @param resource
9252
9252
  * @returns
9253
9253
  */
9254
- #InvokeResourceAPI = async (url, httpVerb, versionIdETag, resource) => {
9254
+ #InvokeResourceAPI = async (url, httpVerb, versionIdETag, resource, contentType) => {
9255
9255
  const accessToken = await this.#options.GetAccessToken();
9256
9256
  let requestConfig;
9257
9257
  const headers = {
@@ -9259,9 +9259,13 @@ var FhirRESTClient = class {
9259
9259
  Accept: "application/fhir+json"
9260
9260
  };
9261
9261
  if (versionIdETag && versionIdETag !== "") headers["If-Match"] = versionIdETag;
9262
- if (httpVerb === "patch") if (resource && resource.contained) requestConfig = new _nsshunt_stsutils.STSAxiosConfig(url, httpVerb).withApplicationMergePatchAndJsonContentTypeHeaders();
9263
- else requestConfig = new _nsshunt_stsutils.STSAxiosConfig(url, httpVerb).withApplicationJsonPatchAndJsonContentTypeHeaders();
9264
- else requestConfig = new _nsshunt_stsutils.STSAxiosConfig(url, httpVerb).withApplicationFhirAndJsonContentTypeHeaders();
9262
+ if (httpVerb === "patch") {
9263
+ requestConfig = new _nsshunt_stsutils.STSAxiosConfig(url, httpVerb).withApplicationMergePatchAndJsonContentTypeHeaders();
9264
+ if (resource && contentType) {
9265
+ if (contentType.localeCompare("application/merge-patch+json") === 0) requestConfig = new _nsshunt_stsutils.STSAxiosConfig(url, httpVerb).withApplicationMergePatchAndJsonContentTypeHeaders();
9266
+ else if (contentType.localeCompare("application/json-patch+json") === 0) requestConfig = new _nsshunt_stsutils.STSAxiosConfig(url, httpVerb).withApplicationJsonPatchAndJsonContentTypeHeaders();
9267
+ }
9268
+ } else requestConfig = new _nsshunt_stsutils.STSAxiosConfig(url, httpVerb).withApplicationFhirAndJsonContentTypeHeaders();
9265
9269
  requestConfig.withAuthHeaders(accessToken, this.#options.user).withHeaders(headers);
9266
9270
  if (resource) requestConfig.withData(resource);
9267
9271
  if (this.#options.agentManager) requestConfig.withAgentManager(this.#options.agentManager);
@@ -9363,7 +9367,7 @@ var FhirRESTClient = class {
9363
9367
  PatchResource = async (resourceType, resourceId, domainResource, contentType, versionIdETag) => {
9364
9368
  try {
9365
9369
  let url = `${`${this.BaseUrl()}/${resourceType}`}/${resourceId}`;
9366
- const retVal = await this.#InvokeResourceAPI(url, "patch", versionIdETag, domainResource);
9370
+ const retVal = await this.#InvokeResourceAPI(url, "patch", versionIdETag, domainResource, contentType);
9367
9371
  if (retVal) return {
9368
9372
  status: retVal.status,
9369
9373
  body: retVal.data