Skip to content

Commit

Permalink
Use status instead of xhr_status
Browse files Browse the repository at this point in the history
  • Loading branch information
imranismail committed Oct 7, 2018
1 parent 39e34b3 commit d708f98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/turbolinks/helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule Turbolinks.Helpers do
def redirect(conn, opts) do
if xhr?(conn) do
conn
|> Plug.Conn.put_status(opts[:xhr_status] || 302)
|> Plug.Conn.put_status(opts[:status] || 302)
|> js(turbolinks_resp(opts[:to] || opts[:external], conn.method))
else
Phoenix.Controller.redirect(conn, opts)
Expand Down
4 changes: 2 additions & 2 deletions test/turbolinks_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ defmodule TurbolinksTest do
assert conn.status == 302
end

test "returns the conn with status 308 if :xhr_status is 308" do
test "returns the conn with status 308 if :status is 308" do
conn =
conn(:post, "/", "")
|> put_req_header("x-requested-with", "XMLHttpRequest")
|> redirect(to: "/url", xhr_status: 308)
|> redirect(to: "/url", status: 308)

assert conn.status == 308
end
Expand Down

0 comments on commit d708f98

Please sign in to comment.