Skip to content

Commit

Permalink
Revert "Revert "NVSS 509: Made destination endpoint validation case i…
Browse files Browse the repository at this point in the history
…nsensitive""
  • Loading branch information
RobertScalfani authored Nov 2, 2023
1 parent 96df967 commit d2edb3f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 17 additions & 0 deletions messaging.tests/Integration/BundlesControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
3 changes: 2 additions & 1 deletion messaging/Controllers/BundlesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ private bool validateNCHSDestination(string destination)
List<string> 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":
Expand Down

0 comments on commit d2edb3f

Please sign in to comment.