howdy/filter

built in filter functions for Howdy

Types

pub type Filter =
  fn(Context) -> Response(BitBuilder)

Functions

pub fn accepts_html(filter: fn(Context) -> Response(BitBuilder)) -> fn(
  Context,
) -> Response(BitBuilder)

filters on the the Accept value equalling ‘application/html’

filters: [accepts_html]
pub fn accepts_json(filter: fn(Context) -> Response(BitBuilder)) -> fn(
  Context,
) -> Response(BitBuilder)

filters on the the Accept value equalling ‘application/json’

filters: [accepts_json]
pub fn must_accept(filter: fn(Context) -> Response(BitBuilder), mime_type: String) -> fn(
  Context,
) -> Response(BitBuilder)

Filters on the mime type in the request headers of the ‘Accept’ key

Example

 filters: [ must_accept(_,"application/json")]