From b5fdf02af0a803601ad34545bb71d8ac15bba221 Mon Sep 17 00:00:00 2001 From: dbmercer Date: Mon, 8 Oct 2012 14:25:39 -0500 Subject: Modified static example to send appropriate MIME type Modified the static example in the examples subdirectory to use the mimetypes application to determine the appropriate MIME type to send down the wire in the HTTP headers of the reply. --- examples/static/rebar.config | 4 +++- examples/static/src/static_app.erl | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/static/rebar.config b/examples/static/rebar.config index 6ad3062..eb6f194 100644 --- a/examples/static/rebar.config +++ b/examples/static/rebar.config @@ -1,4 +1,6 @@ {deps, [ {cowboy, ".*", - {git, "git://github.com/extend/cowboy.git", "master"}} + {git, "git://github.com/extend/cowboy.git", "master"}}, + {mimetypes, ".*", + {git, "git://github.com/spawngrid/mimetypes.git", "master"}} ]}. diff --git a/examples/static/src/static_app.erl b/examples/static/src/static_app.erl index 0777aec..16ef554 100644 --- a/examples/static/src/static_app.erl +++ b/examples/static/src/static_app.erl @@ -14,7 +14,8 @@ start(_Type, _Args) -> Dispatch = [ {'_', [ {['...'], cowboy_static, [ - {directory, {priv_dir, static, []}} + {directory, {priv_dir, static, []}}, + {mimetypes, {fun mimetypes:path_to_mimes/2, default}} ]} ]} ], -- cgit v1.2.3