elixir-web / weber

[WiP] Web framework for Elixir inspired by Rails [#WeberMVC at freenode]
http://elixir-web.github.io/weber/
MIT License
372 stars 33 forks source link

Status Code for JSON Response #179

Closed rcdilorenzo closed 10 years ago

rcdilorenzo commented 10 years ago

Hey there,

Maybe I'm missing something simple, but how do I set the status code for a json response from a controller?

I can't seem to even get {:nothing, ["Cache-Control", "no-cache"], http_status :: integer} to work. Here's my code below:

def check_login([], conn) do
  # ...
  conn = conn.status(401)
  IO.puts conn.status
  {:json, 401, [], []}
end

...which results in either a 500 error or a 200.

0xAX commented 10 years ago

Json returns 200 everytime now, it's easy to add if need HTTP status to json response

rcdilorenzo commented 10 years ago

So, is the return value of this action passed to Handler.WeberReqHandler.Default.request?