@@ -1374,7 +1374,7 @@ defmodule Plug.Conn do
1374
1374
this function is solely to allow an application to issue an upgrade request, not to manage how
1375
1375
a given protocol upgrade takes place or what APIs the application must support in order to serve
1376
1376
this updated protocol. For details in this regard, consult the documentation of the underlying
1377
- adapter (such a Plug.Cowboy or Bandit).
1377
+ adapter (such a [ Plug.Cowboy](https://hexdocs.pm/plug_cowboy) or [ Bandit](https://hexdocs.pm/bandit) ).
1378
1378
1379
1379
Takes an argument describing the requested upgrade (for example, `:websocket`), and an argument
1380
1380
which contains arbitrary data which the underlying adapter is expected to interpret in the
@@ -1383,12 +1383,13 @@ defmodule Plug.Conn do
1383
1383
If the upgrade is accepted by the adapter, the returned `Plug.Conn` will have a `state` of
1384
1384
`:upgraded`. This state is considered equivalently to a 'sent' state, and is subject to the same
1385
1385
limitation on subsequent mutating operations. Note that there is no guarantee or expectation
1386
- that the actual upgrade process is undertaken within this function; it is entirely possible that
1387
- the server will only do the actual upgrade later in the connection lifecycle.
1386
+ that the actual upgrade process has succeeded, or event that it is undertaken within this
1387
+ function; it is entirely possible (likely, even) that the server will only do the actual upgrade
1388
+ later in the connection lifecycle.
1388
1389
1389
- If the adapter does not support the requested upgrade then this is a noop and the returned
1390
- `Plug.Conn` will be unchanged . The application can detect this and operate on the conn as it
1391
- normally would in order to indicate an upgrade failure to the client .
1390
+ If the adapter does not support the requested protocol this function will raise an
1391
+ `ArgumentError` . The underlying adapter may also signal errors in the provided arguments by
1392
+ raising; consult the corresponding adapter documentation for details .
1392
1393
"""
1393
1394
@ spec upgrade_adapter ( t , atom , term ) :: t
1394
1395
def upgrade_adapter ( % Conn { adapter: { adapter , payload } , state: state } = conn , protocol , args )
0 commit comments