Enum poem_openapi::response::StaticFileResponse
source · [−]pub enum StaticFileResponse {
Ok(Binary<Body>, Option<String>, Option<String>),
NotModified,
BadRequest,
NotFound,
PreconditionFailed,
RangeNotSatisfiable(String),
InternalServerError(PlainText<String>),
}
static-files
only.Expand description
A static file response.
Variants
Ok(Binary<Body>, Option<String>, Option<String>)
Tuple Fields
1: Option<String>
The ETag (or entity tag) HTTP response header is an identifier for a specific version of a resource. It lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content was not changed. Additionally, etags help to prevent simultaneous updates of a resource from overwriting each other (“mid-air collisions”).
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
2: Option<String>
The Last-Modified response HTTP header contains a date and time when the origin server believes the resource was last modified. It is used as a validator to determine if the resource is the same as the previously stored one. Less accurate than an ETag header, it is a fallback mechanism. Conditional requests containing If-Modified-Since or If-Unmodified-Since headers make use of this field.
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified
Ok
NotModified
Not modified
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304
BadRequest
Bad request
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
NotFound
Resource was not found
PreconditionFailed
Precondition failed
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412
RangeNotSatisfiable(String)
Tuple Fields
0: String
The Content-Range response HTTP header indicates where in a full body message a partial message belongs.
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range
Range not satisfiable
Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416
InternalServerError(PlainText<String>)
Internal server error
Implementations
Create a static file response.
Trait Implementations
If true, it means that the response object has a custom bad request handler. Read more
Register the schema contained in this response object to the registry.
Convert poem::Error
to this response object.
Performs the conversion.
Consume itself and return Response
.
fn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self> where
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
fn with_header<K, V>(self, key: K, value: V) -> WithHeader<Self> where
K: TryInto<HeaderName>,
V: TryInto<HeaderValue>,
Wrap an impl IntoResponse
to add a header. Read more
Wrap an impl IntoResponse
to set a status code. Read more
Auto Trait Implementations
impl !RefUnwindSafe for StaticFileResponse
impl Send for StaticFileResponse
impl Sync for StaticFileResponse
impl Unpin for StaticFileResponse
impl !UnwindSafe for StaticFileResponse
Blanket Implementations
Mutably borrows from an owned value. Read more
Consumes this value returns a poem::Result<T>
.
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more