mschae / trailing_format_plug

An elixir plug to support legacy APIs that use a rails-like trailing format: http://api.dev/resources.json
25 stars 15 forks source link

Bad response for Not Found resources #15

Closed peillis closed 7 years ago

peillis commented 7 years ago

Having this plug if I ask for a url like http://localhost:4000/hey.txt I receive a response with a 404 status (which is good, because I have no such file), but "Internal server error" as body.

Investigating I've seen that a template 404.txt has been assigned (view_template: "404.txt") and I guess then the following code in ErrorView is executed:

  # In case no render clause matches or no
  # template is found, let's render it as 500
  def template_not_found(_template, assigns) do
    render "500.html", assigns
  end

giving the bad body message.

mschae commented 7 years ago

I think this is a dupe of #10 - I will reopen that one and check it out. Currently travelling so short on time but should get around to this quickly.