Skip to content

Commit c37389e

Browse files
fix _format param, but raise additional question
1 parent 3bfc4c7 commit c37389e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

apps/fhir/bluebutton/tests/test_read_and_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
def get_expected_read_request(version: int):
2727
return {
2828
'method': 'GET',
29-
'url': f'{FHIR_SERVER["FHIR_URL"]}/v{version}/fhir/Patient/{FHIR_ID_V2}/?_format=json&_id={FHIR_ID_V2}',
29+
'url': f'{FHIR_SERVER["FHIR_URL"]}/v{version}/fhir/Patient/{FHIR_ID_V2}/?_format=application/json+fhir&_id={FHIR_ID_V2}',
3030
'headers': {
3131
# 'User-Agent': 'python-requests/2.20.0',
3232
'Accept-Encoding': 'gzip, deflate',

apps/fhir/bluebutton/views/viewsets_base.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ def filter_parameters(self, request):
6868
schema = Schema(self.get_query_schema(), extra=REMOVE_EXTRA)
6969
return schema(params)
7070

71-
# TODO - investigate if this is needed, or if we can assume application/json+fhir everywhere
71+
# TODO - investigate a better way to structure this
7272
def build_parameters(self, request):
73-
return {'_format': 'application/json'}
73+
if getattr(self, 'action', None) != 'list':
74+
return {
75+
'_format': 'application/json+fhir',
76+
}
77+
return {
78+
'_format': 'application/json+fhir',
79+
}

apps/testclient/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class EndpointUrl:
3131
coverage = "coverage"
3232
nav = "nav"
3333

34+
# TODO - theses are all format=json, not format=application/json+fhir, is this good?
35+
@staticmethod
3436
def fmt(name: str, uri: str, version: int, patient: str = BAD_PATIENT_ID):
3537
version_as_string = Versions.as_str(version)
3638
match name:
@@ -52,6 +54,7 @@ def fmt(name: str, uri: str, version: int, patient: str = BAD_PATIENT_ID):
5254
# never occur, and therefore we want something to break.
5355
raise EndpointFormatException(f'Could not format URI name[{name}] uri[{uri}] version[{version_as_string}]')
5456

57+
@staticmethod
5558
def nav_uri(uri, count, start_index, id_type=None, id=None):
5659
return f'{uri}&_count={count}&startIndex={start_index}&{id_type}={id}'
5760

0 commit comments

Comments
 (0)