Module rouille::content_encoding [−][src]
Expand description
Apply content encodings (such as gzip compression) to the response.
This module provides access to the content encodings supported by a request as well as a function to automatically apply common content encodings to a response.
Basic example
Here is a basic example showing how to use content encodings:
use rouille::Request;
use rouille::Response;
use rouille::content_encoding;
fn handle_request(request: &Request) -> Response {
let mut text = String::new();
for encoding in content_encoding::accepted_content_encodings(request) {
text.push_str(encoding);
text.push('\n');
}
let response = Response::text(&text);
content_encoding::apply(&request, response)
}
Structs
Iterator to the list of content encodings accepted by a request.
Functions
Returns an iterator of the list of content encodings accepted by the request.
Applies content encoding to the response.