liquid-rescale-api/src/routes/liquid.rs

20 lines
576 B
Rust

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