Raise fault when response body overflow

How to capture Body buffer overflow and raise fault in OKAPI ( Code 422 -- msg Reposne is larger than 10 MB)

At this stage we can't use streaming due to dependencies on several systems Just want to inform upstream ..

Any example is appriciated

{ 
  "fault": { 
    "faultstring" : "Body buffer overflow",
    "detail": {
      "errorcode": "protocol.http.TooBigBody"
    }
  }
}
0 1 106
1 REPLY 1

Not applicable

can you add an assign message policy in fault rule with the condition to check the fault string?