diff options
author | dbmercer <[email protected]> | 2012-10-08 14:25:39 -0500 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-10-11 20:47:35 +0200 |
commit | b5fdf02af0a803601ad34545bb71d8ac15bba221 (patch) | |
tree | a98369b888ffe54749b04d5439c16e0ccf6d7c6e | |
parent | 1f9d71c3f5cbc2887a6f1362f5b8cd9b52b21390 (diff) | |
download | cowboy-b5fdf02af0a803601ad34545bb71d8ac15bba221.tar.gz cowboy-b5fdf02af0a803601ad34545bb71d8ac15bba221.tar.bz2 cowboy-b5fdf02af0a803601ad34545bb71d8ac15bba221.zip |
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.
-rw-r--r-- | examples/static/rebar.config | 4 | ||||
-rw-r--r-- | examples/static/src/static_app.erl | 3 |
2 files changed, 5 insertions, 2 deletions
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}} ]} ]} ], |