From d2edb3f6832e6d755220fbb16a711bdc0112e98d Mon Sep 17 00:00:00 2001 From: Robert Scalfani Date: Thu, 2 Nov 2023 13:48:48 -0400 Subject: [PATCH] Revert "Revert "NVSS 509: Made destination endpoint validation case insensitive"" --- .../Integration/BundlesControllerTests.cs | 17 +++++++++++++++++ messaging/Controllers/BundlesController.cs | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/messaging.tests/Integration/BundlesControllerTests.cs b/messaging.tests/Integration/BundlesControllerTests.cs index 533fb39..a61acca 100644 --- a/messaging.tests/Integration/BundlesControllerTests.cs +++ b/messaging.tests/Integration/BundlesControllerTests.cs @@ -557,6 +557,23 @@ public async void PostNCHSIsInDestinationEndpointList() Assert.Equal(HttpStatusCode.NoContent, createSubmissionMessage.StatusCode); } + [Fact] + public async void PostNCHSIsInDestinationEndpointListUppercase() + { + // Clear any messages in the database for a clean test + DatabaseHelper.ResetDatabase(_context); + + // Create a new empty Death Record WITH nchs in the endpoint list + DeathRecordSubmissionMessage recordSubmission = new DeathRecordSubmissionMessage(new DeathRecord()); + recordSubmission.JurisdictionId = "MA"; + recordSubmission.MessageSource = "http://example.fhir.org"; + recordSubmission.CertNo = 1; + recordSubmission.MessageDestination = "temp,http://nchs.CDC.gov/VRDR_Submission,temp"; + // Submit that Death Record + HttpResponseMessage createSubmissionMessage = await JsonResponseHelpers.PostJsonAsync(_client, $"/MA/Bundle", recordSubmission.ToJson()); + Assert.Equal(HttpStatusCode.NoContent, createSubmissionMessage.StatusCode); + } + [Fact] public async void PostCatchMissingId() { diff --git a/messaging/Controllers/BundlesController.cs b/messaging/Controllers/BundlesController.cs index 79ab094..d29b7c0 100644 --- a/messaging/Controllers/BundlesController.cs +++ b/messaging/Controllers/BundlesController.cs @@ -494,7 +494,8 @@ private bool validateNCHSDestination(string destination) List destinationEndpoints = destination.Split(',').ToList(); foreach (string d in destinationEndpoints) { - switch (d) + // set the message destination to lowercase to make the url validation case-insensitive + switch (d.ToLower()) { case "http://nchs.cdc.gov/vrdr_acknowledgement": case "http://nchs.cdc.gov/vrdr_alias":