Summary
This library is intended to be a comprehensive solution to parsing and selecting quality-indexed values in HTTP headers. It is capable of parsing both media types and language parameters from the Accept and Content header families, and can be extended to match against other accept headers as well. Selecting the appropriate header value is achieved by comparing a list of server options against the quality-indexed values supplied by the client. In the following example, the Accept header is parsed and then matched against a list of server options to serve the appropriate media using 'mapAcceptMedia': > getHeader >>= maybe send406Error sendResourceWith . mapAcceptMedia > [ ("text/html", asHtml) > , ("application/json", asJson) > ] Similarly, the Content-Type header can be used to produce a parser for request bodies based on the given content type with 'mapContentMedia': > getContentType >>= maybe send415Error readRequestBodyWith . mapContentMedia > [ ("application/json", parseJson) > , ("text/plain", parseText) > ] The API is agnostic to your choice of server.
Versions
v0.8.0.0 :: 0/0.8.0.0 :: gentoo
- Modified
- License
- MIT
- Keywords
- amd64 ~arm64 ~ppc64 ~riscv ~x86
- USE flags
- doc hscolour profile test
USE flags
General
- doc
- Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
- hscolour
- Include coloured haskell sources to generated documentation (dev-haskell/hscolour)
- profile
- Add support for software performance analysis (will likely vary from ebuild to ebuild)
- test
- Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
Dependencies
dev-haskell / cabal : A framework for packaging Haskell software
dev-haskell / case-insensitive : Case insensitive string comparison
dev-haskell / hscolour : Colourise Haskell code
dev-haskell / quickcheck : Automatic testing of Haskell programs
dev-haskell / test-framework : Framework for running and organising tests, with HUnit and QuickCheck support
dev-haskell / test-framework-quickcheck2 : QuickCheck2 support for the test-framework package
dev-haskell / utf8-string : Support for reading and writing UTF8 Strings
Runtime Dependencies
dev-haskell / case-insensitive : Case insensitive string comparison
dev-haskell / utf8-string : Support for reading and writing UTF8 Strings
Depending packages
dev-haskell / servant : A family of combinators for defining webservices APIs
dev-haskell / servant-server : A family of combinators for defining webservices APIs and serving them
Change logs
- Repository mirror & CI · gentoo
Merge updates from master - hololeap · gentoo
dev-haskell/http-media: Stabilize for amd64
Signed-off-by: hololeap <hololeap@users.noreply.github.com> Signed-off-by: Sam James <sam@gentoo.org> - Repository mirror & CI · gentoo
Merge updates from master - matoro · gentoo
dev-haskell/http-media: keyword 0.8.0.0 for ~riscv
Signed-off-by: Jakov Smolić <jsmolic@gentoo.org> - Repository mirror & CI · gentoo
Merge updates from master - matoro · gentoo
dev-haskell/http-media: keyword 0.8.0.0 for ~arm64
Thanks-to: Marcus Comstedt <marcus@mc.pp.se> Signed-off-by: Sam James <sam@gentoo.org> - Repository mirror & CI · gentoo
Merge updates from master - matoro · gentoo
dev-haskell/http-media: new package, add 0.8.0.0
Signed-off-by: matoro <matoro@users.noreply.github.com> Signed-off-by: Sam James <sam@gentoo.org>