Skip to content

Commit

Permalink
[Fix #28] Change catch-all path
Browse files Browse the repository at this point in the history
  • Loading branch information
harenson committed Nov 30, 2015
1 parent 1f81947 commit d0ddaa8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cowboy_swagger_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ trails() ->
{file, StaticFiles ++ "/index.html"},
#{get => #{tags => ["static-content"], description => "index.html"}}),
Static2 = trails:trail(
"/[...]",
"/api-docs/[...]",
cowboy_static,
{dir, StaticFiles, [{mimetypes, cow_mimetypes, all}]},
#{get => #{tags => ["static-content"], description => "Static Content"}}),
Expand Down
12 changes: 12 additions & 0 deletions test/cowboy_swagger_handler_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,16 @@ handler_test(_Config) ->
{ok, Index} = file:read_file("../../priv/swagger/index.html"),
Index = Body1,

%% GET swagger-ui.js - test /api-docs/[...] trail
ct:comment("GET /api-docs/swagger-ui-js should return 200 OK"),
#{status_code := 200, body := SwaggerUIBody} =
cowboy_swagger_test_utils:api_call(get, "/api-docs/swagger-ui.js"),
{ok, SwaggerUIBodySrc} = file:read_file("../../priv/swagger/swagger-ui.js"),
SwaggerUIBody = SwaggerUIBodySrc,

%% GET unknown-file.ext - test /api-docs/[...] trail
ct:comment("GET /api-docs/unknown-file.ext should return 404 NOT FOUND"),
#{status_code := 404} =
cowboy_swagger_test_utils:api_call(get, "/api-docs/unknown-file.ext"),

{comment, ""}.

0 comments on commit d0ddaa8

Please sign in to comment.