diff --git a/src/shotgun.app.src b/src/shotgun.app.src
index 3e104e4..50ecdb0 100644
--- a/src/shotgun.app.src
+++ b/src/shotgun.app.src
@@ -2,7 +2,7 @@
[
{description,
"better than just a gun"},
- {vsn, "0.1.13"},
+ {vsn, "0.1.14"},
{applications,
[kernel,
stdlib,
diff --git a/src/shotgun.erl b/src/shotgun.erl
index ead516f..459ad7f 100644
--- a/src/shotgun.erl
+++ b/src/shotgun.erl
@@ -156,12 +156,12 @@ close(Pid) ->
ok.
%% @equiv get(Pid, Uri, #{}, #{})
--spec get(pid(), string()) -> result().
+-spec get(pid(), iodata()) -> result().
get(Pid, Uri) ->
get(Pid, Uri, #{}, #{}).
%% @equiv get(Pid, Uri, Headers, #{})
--spec get(pid(), string(), headers()) -> result().
+-spec get(pid(), iodata(), headers()) -> result().
get(Pid, Uri, Headers) ->
get(Pid, Uri, Headers, #{}).
@@ -191,50 +191,50 @@ get(Pid, Uri, Headers) ->
%%
%%
%% @end
--spec get(pid(), string(), headers(), options()) -> result().
+-spec get(pid(), iodata(), headers(), options()) -> result().
get(Pid, Uri, Headers, Options) ->
request(Pid, get, Uri, Headers, [], Options).
%% @doc Performs a POST request to Uri
using
%% Headers
and Body
as the content data.
--spec post(pid(), string(), headers(), iodata(), options()) -> result().
+-spec post(pid(), iodata(), headers(), iodata(), options()) -> result().
post(Pid, Uri, Headers, Body, Options) ->
request(Pid, post, Uri, Headers, Body, Options).
%% @doc Performs a DELETE request to Uri
using
%% Headers
.
--spec delete(pid(), string(), headers(), options()) -> result().
+-spec delete(pid(), iodata(), headers(), options()) -> result().
delete(Pid, Uri, Headers, Options) ->
request(Pid, delete, Uri, Headers, [], Options).
%% @doc Performs a HEAD request to Uri
using
%% Headers
.
--spec head(pid(), string(), headers(), options()) -> result().
+-spec head(pid(), iodata(), headers(), options()) -> result().
head(Pid, Uri, Headers, Options) ->
request(Pid, head, Uri, Headers, [], Options).
%% @doc Performs a OPTIONS request to Uri
using
%% Headers
.
--spec options(pid(), string(), headers(), options()) -> result().
+-spec options(pid(), iodata(), headers(), options()) -> result().
options(Pid, Uri, Headers, Options) ->
request(Pid, options, Uri, Headers, [], Options).
%% @doc Performs a PATCH request to Uri
using
%% Headers
and Body
as the content data.
--spec patch(pid(), string(), headers(), iodata(), options()) -> result().
+-spec patch(pid(), iodata(), headers(), iodata(), options()) -> result().
patch(Pid, Uri, Headers, Body, Options) ->
request(Pid, patch, Uri, Headers, Body, Options).
%% @doc Performs a PUT request to Uri
using
%% Headers
and Body
as the content data.
--spec put(pid(), string(), headers(), iodata(), options()) -> result().
+-spec put(pid(), iodata(), headers(), iodata(), options()) -> result().
put(Pid, Uri, Headers0, Body, Options) ->
request(Pid, put, Uri, Headers0, Body, Options).
%% @doc Performs a request to Uri
using the HTTP method
%% specified by Method
, Body
as the content data and
%% Headers
as the request's headers.
--spec request(pid(), http_verb(), string(), headers(), iodata(), options()) ->
+-spec request(pid(), http_verb(), iodata(), headers(), iodata(), options()) ->
result().
request(Pid, get, Uri, Headers0, Body, Options) ->
try
@@ -635,7 +635,11 @@ sse_events(IsFin, Data, State = #{buffer := Buffer}) ->
%% @private
check_uri([$/ | _]) -> ok;
-check_uri(_) -> throw(missing_slash_uri).
+check_uri(U) ->
+ case iolist_to_binary(U) of
+ <<"/", _/binary>> -> ok;
+ _ -> throw (missing_slash_uri)
+ end.
%% @private
enqueue_work_or_stop(FSM = at_rest, Event, From, State) ->