logo
pub enum StaticFileResponse {
    Ok(Binary<Body>, Option<String>, Option<String>),
    NotModified,
    BadRequest,
    NotFound,
    PreconditionFailed,
    RangeNotSatisfiable(String),
    InternalServerError(PlainText<String>),
}
This is supported on crate feature 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

BadRequest

NotFound

Resource was not found

PreconditionFailed

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

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

Gets metadata of this response.

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.

Wrap an impl IntoResponse to add a header. Read more

Wrap an impl IntoResponse to set a status code. Read more

Wrap an impl IntoResponse to set a body. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Consumes this value returns a poem::Result<T>.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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