Skip to content

Commit 561ac4d

Browse files
[ERSSUP-89806]-[]-[Fixed reason phrases for error responses]-[JW]
1 parent 27a570d commit 561ac4d

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

proxies/live/apiproxy/policies/AssignMessage.OperationOutcomeErrorResponse.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<AssignMessage async="false" continueOnError="false" enabled="true" name="AssignMessage.OperationOutcomeErrorResponse">
22
<Set>
33
<StatusCode>{status_code}</StatusCode>
4-
<ReasonPhrase>Unauthorized</ReasonPhrase>
4+
<ReasonPhrase>{reason_phrase}</ReasonPhrase>
55
<Payload contentType="application/fhir+json" variablePrefix="%" variableSuffix="#">{ "resourceType": "OperationOutcome", "meta": { "lastUpdated": "%current_timestamp#", "profile" : [ "%op_outcome_fhir_profile#" ] }, "issue": [ { "severity": "error", "code": "%op_outcome_issue_code#", "details": { "coding": [ { "system": "%op_outcome_issue_details_coding_system#", "code": "%op_outcome_issue_details_coding_code#" } ] }, "diagnostics": "%faultstring#" } ] }</Payload>
66
</Set>
77
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>

proxies/live/apiproxy/policies/AssignMessage.SetOperationOutcomeInvalidBusinessFunction.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@
1111
<Name>status_code</Name>
1212
<Value>403</Value>
1313
</AssignVariable>
14+
<AssignVariable>
15+
<Name>reason_phrase</Name>
16+
<Value>Forbidden</Value>
17+
</AssignVariable>
1418
</AssignMessage>

proxies/live/apiproxy/policies/AssignMessage.SetOperationOutcomeIssueIal.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
<Name>status_code</Name>
44
<Value>401</Value>
55
</AssignVariable>
6+
<AssignVariable>
7+
<Name>reason_phrase</Name>
8+
<Value>Unauthorized</Value>
9+
</AssignVariable>
610
<AssignVariable>
711
<Name>op_outcome_issue_code</Name>
812
<Value>forbidden</Value>

proxies/live/apiproxy/policies/AssignMessage.SetOperationOutcomeMissingAsid.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@
1111
<Name>status_code</Name>
1212
<Value>403</Value>
1313
</AssignVariable>
14+
<AssignVariable>
15+
<Name>reason_phrase</Name>
16+
<Value>Forbidden</Value>
17+
</AssignVariable>
1418
</AssignMessage>

tests/integration/test_headers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ async def test_headers_on_echo_target_with_app_restricted_business_function(
116116
+ str(response.status_code)
117117
)
118118

119+
assert response.reason == "Forbidden"
120+
119121
# Verify the OperationOutcome payload
120122
response_data = response.json()
121123
assert response_data["resourceType"] == "OperationOutcome"
@@ -508,6 +510,8 @@ def test_unknown_access_code(
508510
response.status_code
509511
)
510512

513+
assert response.reason == "Unauthorized"
514+
511515
if not is_operation_outcome:
512516
assert len(response.content) == 0
513517
else:

0 commit comments

Comments
 (0)