26 lines
854 B
Rust
26 lines
854 B
Rust
use crate::http_api::headers::upload_headers;
|
|
use axum::http::HeaderValue;
|
|
use axum::response::{IntoResponseParts, ResponseParts};
|
|
|
|
pub struct UploadCompleteResponseHeader(pub bool);
|
|
|
|
impl IntoResponseParts for UploadCompleteResponseHeader {
|
|
type Error = ();
|
|
|
|
fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
|
|
res.headers_mut()
|
|
.insert(upload_headers::UPLOAD_COMPLETE, HeaderValue::from_static(if self.0 { "?1" } else { "?0" }));
|
|
Ok(res)
|
|
}
|
|
}
|
|
|
|
pub struct UploadOffsetResponseHeader(pub u64);
|
|
|
|
impl IntoResponseParts for UploadOffsetResponseHeader {
|
|
type Error = ();
|
|
|
|
fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
|
|
res.headers_mut().insert(upload_headers::UPLOAD_OFFSET, self.0.into());
|
|
Ok(res)
|
|
}
|
|
}
|