[erlang-questions] cowboy Accept header, rest module

Daniel Goertzen <>
Wed Jun 6 17:35:16 CEST 2012


I have 2 cowboy questions:

1. I am trying to parse the Accept header using...

   cowboy_http_req:parse_header('Accept', Req)

The raw header is...

*{'Accept',<<"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8">>}
*
*
*
*and the output is ...*

* [{{<<"text">>,<<"html">>,[]},1000,[]},
{{<<"application">>,<<"xhtml+xml">>,[]},1000,[]},
{{<<"application">>,<<"xml">>,[]},900,[]},
{{<<"*">>,<<"*">>,[]},800,[]}]*


What do all the parts of the tuple mean? (it is mainly the number that is
piquing my curiosity)



2. I am looking to make a restful web interface using cowboy.  The basic
cowboy_http_protocol module with its dispatch table seems very nice for
this, and along with its request parsing I have difficulty imagining what
more I could need.  What does the cowboy_http_rest module buy you?  Note
that this is my first web interface in any language and I had trouble
penetrating the webmachine documentation (I suspect knowing nothing about
mochiweb is causing problems for me).

Thanks,
Dan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120606/7ce3e2d6/attachment.html>


More information about the erlang-questions mailing list