diff --git a/proxmox-rest-server/src/formatter.rs b/proxmox-rest-server/src/formatter.rs index d05ddd93..d19d6805 100644 --- a/proxmox-rest-server/src/formatter.rs +++ b/proxmox-rest-server/src/formatter.rs @@ -166,6 +166,8 @@ pub(crate) fn error_to_response(err: Error) -> Response
{ /// /// * ``success``: boolean attribute indicating the success. /// +/// * ``status``: api call status code. +/// /// * ``data``: The result data (on success) /// /// * ``message``: The error message (on failure) @@ -174,8 +176,9 @@ pub(crate) fn error_to_response(err: Error) -> Response { /// /// Any result attributes set on ``rpcenv`` are also added to the object. /// -/// Please note that errors return status code OK, but setting success -/// to false. +/// Please note that errors return a HTTP response with status code OK, but setting success +/// to false. The real status from the API call is encoded in the status +/// property. pub static EXTJS_FORMATTER: &'static dyn OutputFormatter = &ExtJsFormatter(); struct ExtJsFormatter(); @@ -184,7 +187,8 @@ impl OutputFormatter for ExtJsFormatter { fn format_data(&self, data: Value, rpcenv: &dyn RpcEnvironment) -> Response { let mut result = json!({ "data": data, - "success": true + "success": true, + "status": StatusCode::OK.as_u16(), }); add_result_attributes(&mut result, rpcenv); @@ -199,6 +203,7 @@ impl OutputFormatter for ExtJsFormatter { ) -> Result