Skip to content

Commit 546e0a7

Browse files
committed
Merge branch 'develop'
2 parents f6af955 + 4c90767 commit 546e0a7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

sof_wrapper/api/fhir.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
r2prefix = '/v/r2/fhir'
1212
r4prefix = '/v/r4/fhir'
1313

14-
PROXY_HEADERS = ('Authorization', 'Cache-Control')
14+
PROXY_HEADERS = ('Authorization', 'Cache-Control', 'Content-Type')
1515

1616
def collate_results(*result_sets):
1717
"""Compile given result sets into a single bundle"""
@@ -243,8 +243,8 @@ def patient_by_id(id):
243243

244244

245245
@blueprint.route('/fhir-router/', defaults={'relative_path': '', 'session_id': None})
246-
@blueprint.route('/fhir-router/<string:session_id>/<path:relative_path>')
247-
@blueprint.route('/fhir-router/<string:session_id>/', defaults={'relative_path': ''})
246+
@blueprint.route('/fhir-router/<string:session_id>/<path:relative_path>', methods=('DELETE', 'GET', 'POST', 'PUT'))
247+
@blueprint.route('/fhir-router/<string:session_id>/', defaults={'relative_path': ''}, methods=('DELETE', 'GET', 'POST', 'PUT'))
248248
def route_fhir(relative_path, session_id):
249249
g.session_id = session_id
250250
current_app.logger.debug('received session_id as path parameter: %s', session_id)
@@ -278,8 +278,11 @@ def route_fhir(relative_path, session_id):
278278
if header_name in request.headers:
279279
upstream_headers[header_name] = request.headers[header_name]
280280

281-
upstream_response = requests.get(
281+
upstream_response = requests.request(
282282
url=upstream_fhir_url,
283+
method=request.method,
284+
json=request.json,
285+
data=request.data,
283286
headers=upstream_headers,
284287
params=request.args,
285288
)
@@ -295,6 +298,7 @@ def route_fhir(relative_path, session_id):
295298
@blueprint.after_request
296299
def add_header(response):
297300
response.headers['Access-Control-Allow-Origin'] = '*'
298-
response.headers['Access-Control-Allow-Headers'] = 'Authorization, Cache-Control'
301+
response.headers['Access-Control-Allow-Headers'] = 'Authorization, Cache-Control, Content-Type'
302+
response.headers['Access-Control-Allow-Methods'] = 'DELETE, GET, OPTIONS, POST, PUT'
299303

300304
return response

0 commit comments

Comments
 (0)