return image response instead vector
This commit is contained in:
parent
b7e83f921a
commit
573261911d
@ -1,10 +1,19 @@
|
||||
use axum::{extract::Multipart, Json};
|
||||
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<Json<Vec<u8>>, AppError> {
|
||||
pub async fn liquid_rescale_route(multipart: Multipart) -> Result<Response, AppError> {
|
||||
let image_data = liquid_rescale_processor(multipart).await?;
|
||||
Ok(Json(image_data))
|
||||
let body = Full::from(image_data);
|
||||
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.insert("Content-Type", "image/jpeg".parse().unwrap());
|
||||
Ok((headers, body).into_response())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user