aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_protocols.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gun_protocols.erl')
-rw-r--r--src/gun_protocols.erl5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gun_protocols.erl b/src/gun_protocols.erl
index 4209641..65d5211 100644
--- a/src/gun_protocols.erl
+++ b/src/gun_protocols.erl
@@ -18,6 +18,7 @@
-export([handler/1]).
-export([handler_and_opts/2]).
-export([negotiated/2]).
+-export([stream_ref/1]).
-spec add_stream_ref(Protocol, undefined | gun:stream_ref())
-> Protocol when Protocol :: gun:protocol().
@@ -53,3 +54,7 @@ negotiated({ok, <<"h2">>}, _) -> http2;
negotiated({ok, <<"http/1.1">>}, _) -> http;
negotiated({error, protocol_not_negotiated}, [Protocol]) -> Protocol;
negotiated({error, protocol_not_negotiated}, _) -> http.
+
+-spec stream_ref(gun:protocol()) -> undefined | gun:stream_ref().
+stream_ref({_, ProtocolOpts}) -> maps:get(stream_ref, ProtocolOpts, undefined);
+stream_ref(_) -> undefined.