2023-04-03 01:38:25 +00:00
|
|
|
use axum::{
|
|
|
|
body::Full,
|
|
|
|
extract::Multipart,
|
|
|
|
http::HeaderMap,
|
|
|
|
response::{IntoResponse, Response},
|
|
|
|
};
|
2023-04-03 01:29:27 +00:00
|
|
|
|
|
|
|
use crate::{
|
|
|
|
processors::liquid_rescale_processor::liquid_rescale_processor, utilities::app_error::AppError,
|
|
|
|
};
|
|
|
|
|
2023-04-03 01:38:25 +00:00
|
|
|
pub async fn liquid_rescale_route(multipart: Multipart) -> Result<Response, AppError> {
|
2023-04-03 01:29:27 +00:00
|
|
|
let image_data = liquid_rescale_processor(multipart).await?;
|
2023-04-03 01:38:25 +00:00
|
|
|
let body = Full::from(image_data);
|
|
|
|
|
|
|
|
let mut headers = HeaderMap::new();
|
|
|
|
headers.insert("Content-Type", "image/jpeg".parse().unwrap());
|
|
|
|
Ok((headers, body).into_response())
|
2023-04-03 01:29:27 +00:00
|
|
|
}
|