Skip to content

Commit 8e571d0

Browse files
committed
set status to 101 (switching protocols)
1 parent d63611f commit 8e571d0

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

lib/plug/conn.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,7 @@ defmodule Plug.Conn do
14711471
@spec upgrade_adapter(t, atom, term) :: t
14721472
def upgrade_adapter(%Conn{adapter: {adapter, payload}, state: state} = conn, protocol, args)
14731473
when state in @unsent do
1474-
conn = run_before_send(conn, :set_upgrade)
1474+
conn = run_before_send(%{conn | status: 101}, :set_upgrade)
14751475

14761476
case adapter.upgrade(payload, protocol, args) do
14771477
{:ok, payload} ->

test/plug/conn_test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ defmodule Plug.ConnTest do
512512
conn(:get, "/foo")
513513
|> register_before_send(fn conn ->
514514
send(self(), {:state, conn.state})
515+
assert conn.status == 101
515516

516517
conn
517518
|> put_resp_header("x-test", "UPGRADE")

0 commit comments

Comments
 (0)