[−][src]Function cgi::binary_response
pub fn binary_response<'a, T>(
status_code: T,
content_type: impl Into<Option<&'a str>>,
body: Vec<u8>
) -> Response where
StatusCode: TryFrom<T>,
<StatusCode as TryFrom<T>>::Error: Into<Error>,
Sends blob
with that status code, and optional content type, None
for no Content-Type
header to be set.
No Content-Type
header:
ⓘThis example is not tested
cgi::binary_response(200, None, vec![1, 2]);
Send an image:
ⓘThis example is not tested
cgi::binary_response(200, "image/png", vec![1, 2]);
Send a generic binary blob:
ⓘThis example is not tested
cgi::binary_response(200, "application/octet-stream", vec![1, 2]);