Skip to content

Instantly share code, notes, and snippets.

@yazdotai
Created October 13, 2010 15:17
Show Gist options
  • Select an option

  • Save yazdotai/624238 to your computer and use it in GitHub Desktop.

Select an option

Save yazdotai/624238 to your computer and use it in GitHub Desktop.
-module(httpheaders_resource).
-export([init/1, to_html/2]).
-include_lib("webmachine/include/webmachine.hrl").
init([]) -> {ok, undefined}.
to_html(ReqData, Context) ->
Headers = mochiweb_headers:to_list(wrq:req_headers(ReqData)),
StringConvert = [{X,list_to_binary(Y)} || {X,Y} <- Headers],
Output = mochijson2:encode({struct, StringConvert}),
Body = io:format("~s~n", [Output]),
{Body, Request, Context}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment