Details
-
Story
-
Status: Closed
-
Highest
-
Resolution: Done
-
None
-
None
Description
Current (original response code and message wrapped as big string)
http-status: 500
body: ".... 401 ..... Not found "
Wanted:
http-status: 500
body:
{ "dmi-response": { "http-code": "401", "body": "not found"} }
Question Issue: can we use a well defined json object as error response body with 500 response (defined in OpenApi.yaml)
already defined structure for ALL errors like this:
{ "status": "401", "message": "some message", "details": "{internal json}" }
Solution:
ensure org.onap.cps.ncmp.api.impl.exception.ServerNcmpException#ServerNcmpException (maybe extend?) can store dmi response status and body object as separate properties (if need create a httpRequestException or similar)
see org.onap.cps.ncmp.api.impl.NetworkCmProxyDataServiceImpl#handleResponse
create another method like of org.onap.cps.ncmp.rest.exceptions.NetworkCmProxyRestExceptionHandler#buildErrorResponse -> wrapDmiErrorResponse(ServerNcmpException) to return a reponseEntity with code 500 and an error 'string' that is the proposed json above
Consider use HTTP 502:
"502 Bad GatewayThe server was acting as a gateway or proxy and received an invalid response from the upstream server." so we can have a dedicated format and not mix them up with internal server errors!
Attachments
Issue Links
- relates to
-
CPS-1056 Wrong error response format in case of Dmi plugin error
-
- Closed
-