vmm: http_endpoint: Do not sent 200 status code when our body is empty

Otherwise HTTP client will not close the connection and wait for a
pending body.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2019-11-08 22:46:17 +01:00
parent ede262684d
commit f34ace7673

View File

@ -81,7 +81,7 @@ impl EndpointHandler for VmCreate {
match vm_create(api_notifier, api_sender, Arc::new(vm_config))
.map_err(HttpError::VmCreate)
{
Ok(_) => Response::new(Version::Http11, StatusCode::OK),
Ok(_) => Response::new(Version::Http11, StatusCode::NoContent),
Err(e) => error_response(e, StatusCode::InternalServerError),
}
}
@ -134,7 +134,7 @@ impl EndpointHandler for VmActionHandler {
ApiError::VmResume(_) => HttpError::VmResume(e),
_ => HttpError::VmAction(e),
}) {
Ok(_) => Response::new(Version::Http11, StatusCode::OK),
Ok(_) => Response::new(Version::Http11, StatusCode::NoContent),
Err(e) => error_response(e, StatusCode::InternalServerError),
}
}