elixir-web/weber

Status Code for JSON Response

rcdilorenzo opened this issue · 2 comments

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

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

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