mirror of
https://github.com/valitydev/woody_erlang.git
synced 2024-11-06 02:15:19 +00:00
Allow binary url (#95)
This commit is contained in:
parent
90eca45089
commit
749a3ab309
@ -46,7 +46,7 @@
|
||||
-export_type([handler/1, ev_handler/0, options/0]).
|
||||
|
||||
-type role() :: client | server.
|
||||
-type url() :: string(). %% http://erlang.org/doc/man/httpc.html#http-data-types
|
||||
-type url() :: binary() | string().
|
||||
-type path() :: '_' | iodata(). %% cowboy_router:route_match()
|
||||
-type http_handler(Handler) :: {path(), Handler}.
|
||||
-export_type([role/0, url/0, path/0, http_handler/1]).
|
||||
|
@ -5,7 +5,7 @@
|
||||
-include_lib("kernel/include/inet.hrl").
|
||||
-include_lib("hackney/include/hackney_lib.hrl").
|
||||
|
||||
-type url() :: binary() | nonempty_string().
|
||||
-type url() :: woody:url().
|
||||
-type parsed_url() :: #hackney_url{}.
|
||||
|
||||
-type resolve_result() :: {Old::parsed_url(), New::parsed_url()}.
|
||||
@ -42,7 +42,7 @@ resolve_url(Url, WoodyState) ->
|
||||
{ok, resolve_result()} |
|
||||
{error, Reason :: atom()}.
|
||||
resolve_url(Url, WoodyState, Opts) when is_list(Url) ->
|
||||
resolve_url(list_to_binary(Url), WoodyState, Opts);
|
||||
resolve_url(unicode:characters_to_binary(Url), WoodyState, Opts);
|
||||
resolve_url(<<"https://", _Rest/binary>> = Url, WoodyState, Opts) ->
|
||||
resolve_parsed_url(parse_url(Url), WoodyState, Opts);
|
||||
resolve_url(<<"http://", _Rest/binary>> = Url, WoodyState, Opts) ->
|
||||
|
Loading…
Reference in New Issue
Block a user