Skip to content

Commit f630fe8

Browse files
committed
change e-tag from response body to response header
1 parent a6e00cb commit f630fe8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

backend/src/fhir_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def update_immunization(self, aws_event):
364364
)
365365
return self.create_response(400, json.dumps(exp_error))
366366
if outcome == UpdateOutcome.UPDATE:
367-
return self.create_response(200, {"E-Tag": updated_version}) #include e-tag here, is it not included in the response resource
367+
return self.create_response(200, None, {"E-Tag": updated_version}) #include e-tag here, is it not included in the response resource
368368
except ValidationError as error:
369369
return self.create_response(400, error.to_operation_outcome())
370370
except IdentifierDuplicationError as duplicate:

backend/tests/test_fhir_controller.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ def test_update_immunization(self,mock_get_permissions):
10661066
)
10671067
mock_get_permissions.assert_called_once_with("Test")
10681068
self.assertEqual(response["statusCode"], 200)
1069-
self.assertEqual(json.loads(response["body"]), {"E-Tag": 2})
1069+
self.assertEqual( response["headers"]["E-Tag"], 2)
10701070

10711071
@patch("fhir_controller.get_supplier_permissions")
10721072
def test_update_immunization_etag_missing(self, mock_get_supplier_permissions):
@@ -1262,7 +1262,7 @@ def test_update_deletedat_immunization_with_version(self, mock_get_supplier_perm
12621262
imms_id, json.loads(imms), 1, ["COVID19.CRUDS"], "Test"
12631263
)
12641264
self.assertEqual(response["statusCode"], 200)
1265-
self.assertEqual(json.loads(response["body"]), {"E-Tag": 2})
1265+
self.assertEqual(response["headers"]["E-Tag"], 2)
12661266

12671267
@patch("fhir_controller.get_supplier_permissions")
12681268
def test_update_deletedat_immunization_without_version(self, mock_get_supplier_permissions):
@@ -1291,7 +1291,7 @@ def test_update_deletedat_immunization_without_version(self, mock_get_supplier_p
12911291
)
12921292
mock_get_supplier_permissions.assert_called_once_with("Test")
12931293
self.assertEqual(response["statusCode"], 200)
1294-
self.assertEqual(json.loads(response["body"]), {"E-Tag": 2})
1294+
self.assertEqual(response["headers"]["E-Tag"], 2)
12951295

12961296
@patch("fhir_controller.get_supplier_permissions")
12971297
def test_update_record_exists(self, mock_get_supplier_permissions):
@@ -1507,7 +1507,7 @@ def test_update_immunization_when_reinstated_true(self, mock_get_permissions):
15071507
imms_id, json.loads(imms), 1, ["COVID19.CRUD"], "Test"
15081508
)
15091509
self.assertEqual(response["statusCode"], 200)
1510-
self.assertEqual(json.loads(response["body"]), {"E-Tag": 3})
1510+
self.assertEqual(response["headers"]["E-Tag"], int("3"))
15111511

15121512
def test_update_immunization_missing_id(self):
15131513
"""it should raise KeyError if pathParameters['id'] is missing"""

0 commit comments

Comments
 (0)