ninenines / gun

HTTP/1.1, HTTP/2, Websocket client (and more) for Erlang/OTP.
ISC License
898 stars 231 forks source link

A different result between the document and a program about `gun:ws_upgrade` #146

Closed niku closed 6 years ago

niku commented 6 years ago

Hi, I found a different result between the document and a program when It was executed gun:ws_upgrade.

The document indicates gun:ws_upgrade returns ok. However, a program indicates gun:ws_upgrade returns a type of Reference:

/Users/niku/src/gun% git log --oneline -1
a00a6b2 (HEAD -> master, origin/master, origin/HEAD) Enable ci.erlang.mk only when CI_ERLANG_MK=1 is set
/Users/niku/src/gun% rebar3 shell --apps gun
===> Verifying dependencies...
===> Compiling gun
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]

Eshell V9.3  (abort with ^G)
===> The rebar3 shell is a development tool; to deploy applications in production, consider using releases (http://www.rebar3.org/docs/releases)
===> Booted cowlib
===> Booted ranch
===> Booted gun
1> {ok, ConnPid} = gun:open("echo.websocket.org", 80).
{ok,<0.149.0>}
2> {ok, http} = gun:await_up(ConnPid).
{ok,http}
3> X = gun:ws_upgrade(ConnPid, "/").
#Ref<0.2170381907.506462209.18502>
4>

Which result is intended one?

essen commented 6 years ago

The code is correct. The documentation was supposed to have been updated in a separate commit but I suppose this was either not done or this particular issue was missed.

niku commented 6 years ago

Thank you for your quick reply.

Can I send a PR to fix the document?

essen commented 6 years ago

Yes please.

essen commented 6 years ago

Thanks!