Permalink
Browse files

handles HEAD method

  • Loading branch information...
1 parent 85941b6 commit 747906c4515f856196b738c43451628fae4b0db4 @videlalvaro committed May 6, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/rabbitmq_chat_rest.erl
@@ -32,12 +32,18 @@ stop() ->
handle_http(#http_state{req=Req}=State, _Port) ->
handle(Req:get(method), Req:resource([lowercase, urldecode]), State).
+handle('HEAD', [], #http_state{req=Req}) ->
+ Req:ok("");
+
handle('GET', [], #http_state{req=Req}) ->
Req:file("./priv/www/index.html", [{"Content-Type", "text/html"}]);
handle('GET',["favicon.ico"], #http_state{req=Req}) ->
Req:file("./priv/www/favicon.ico", [{"Content-Type", "image/vnd.microsoft.icon"}]);
+handle('GET',["robots.txt"], #http_state{req=Req}) ->
+ Req:file("./priv/www/robots.txt", [{"Content-Type", "text/plain"}]);
+
%% TODO add file exist support, E-TAGS, etc.
handle('GET', ["js", FileName], #http_state{req=Req}) ->
Req:file(filename:join("./priv/www/js/", FileName), [{"Content-Type", "text/javascript"}]);

0 comments on commit 747906c

Please sign in to comment.