Expand description
Tide middleware to filter requests based on their Content-Type.
As described in tide#805.
§Example
Only process requests with Content-Type: application/json
, returns HTTP
415 Unsupported Media Type for all other requests.
use tide_content_type_filter::ContentTypeFilter;
let mut server = tide::new();
server.with(ContentTypeFilter::only("application/json"));
Only process requests with Content-Type: image/png
or
Content-Type: image/jpeg
:
use tide_content_type_filter::ContentTypeFilter;
let mut server = tide::new();
server.with(ContentTypeFilter::any(vec!["image/png", "image/jpeg"]));
Structs§
- Content
Type Filter - A middleware for filtering requests based on their Content-Type.