summaryrefslogtreecommitdiff
path: root/dev-haskell/http-media/metadata.xml
diff options
context:
space:
mode:
Diffstat (limited to 'dev-haskell/http-media/metadata.xml')
-rw-r--r--dev-haskell/http-media/metadata.xml35
1 files changed, 35 insertions, 0 deletions
diff --git a/dev-haskell/http-media/metadata.xml b/dev-haskell/http-media/metadata.xml
new file mode 100644
index 000000000000..8281b91cfa5b
--- /dev/null
+++ b/dev-haskell/http-media/metadata.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>haskell@gentoo.org</email>
+ <name>Gentoo Haskell</name>
+ </maintainer>
+ <longdescription>
+ 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':
+
+ &gt; getHeader &gt;&gt;= maybe send406Error sendResourceWith . mapAcceptMedia
+ &gt; [ ("text/html", asHtml)
+ &gt; , ("application/json", asJson)
+ &gt; ]
+
+ Similarly, the Content-Type header can be used to produce a parser for request
+ bodies based on the given content type with 'mapContentMedia':
+
+ &gt; getContentType &gt;&gt;= maybe send415Error readRequestBodyWith . mapContentMedia
+ &gt; [ ("application/json", parseJson)
+ &gt; , ("text/plain", parseText)
+ &gt; ]
+
+ The API is agnostic to your choice of server.
+ </longdescription>
+</pkgmetadata>