mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 04:30:25 +00:00
Rename the type http_method/0 to cowboy_http:method/0
Exported types are much better than include files.
This commit is contained in:
parent
3667ec9451
commit
9f40167487
4 changed files with 8 additions and 5 deletions
|
@ -13,8 +13,6 @@
|
||||||
%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
-type http_method() :: 'OPTIONS' | 'GET' | 'HEAD'
|
|
||||||
| 'POST' | 'PUT' | 'DELETE' | 'TRACE' | binary().
|
|
||||||
-type http_uri() :: '*' | {absoluteURI, http | https, Host::binary(),
|
-type http_uri() :: '*' | {absoluteURI, http | https, Host::binary(),
|
||||||
Port::integer() | undefined, Path::binary()}
|
Port::integer() | undefined, Path::binary()}
|
||||||
| {scheme, Scheme::binary(), binary()}
|
| {scheme, Scheme::binary(), binary()}
|
||||||
|
@ -47,7 +45,7 @@
|
||||||
|
|
||||||
%% Request.
|
%% Request.
|
||||||
pid = undefined :: pid(),
|
pid = undefined :: pid(),
|
||||||
method = 'GET' :: http_method(),
|
method = 'GET' :: cowboy_http:method(),
|
||||||
version = {1, 1} :: http_version(),
|
version = {1, 1} :: http_version(),
|
||||||
peer = undefined :: undefined | {inet:ip_address(), inet:ip_port()},
|
peer = undefined :: undefined | {inet:ip_address(), inet:ip_port()},
|
||||||
host = undefined :: undefined | cowboy_dispatcher:tokens(),
|
host = undefined :: undefined | cowboy_dispatcher:tokens(),
|
||||||
|
|
|
@ -26,6 +26,11 @@
|
||||||
-export([connection_to_atom/1, urldecode/1, urldecode/2, urlencode/1,
|
-export([connection_to_atom/1, urldecode/1, urldecode/2, urlencode/1,
|
||||||
urlencode/2]).
|
urlencode/2]).
|
||||||
|
|
||||||
|
-type method() :: 'OPTIONS' | 'GET' | 'HEAD'
|
||||||
|
| 'POST' | 'PUT' | 'DELETE' | 'TRACE' | binary().
|
||||||
|
|
||||||
|
-export_type([method/0]).
|
||||||
|
|
||||||
-include("include/http.hrl").
|
-include("include/http.hrl").
|
||||||
-include_lib("eunit/include/eunit.hrl").
|
-include_lib("eunit/include/eunit.hrl").
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ wait_request(State=#state{socket=Socket, transport=Transport,
|
||||||
{error, _Reason} -> terminate(State)
|
{error, _Reason} -> terminate(State)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec request({http_request, http_method(), http_uri(),
|
-spec request({http_request, cowboy_http:method(), http_uri(),
|
||||||
http_version()}, #state{}) -> ok | none().
|
http_version()}, #state{}) -> ok | none().
|
||||||
request({http_request, _Method, _URI, Version}, State)
|
request({http_request, _Method, _URI, Version}, State)
|
||||||
when Version =/= {1, 0}, Version =/= {1, 1} ->
|
when Version =/= {1, 0}, Version =/= {1, 1} ->
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
%% Request API.
|
%% Request API.
|
||||||
|
|
||||||
%% @doc Return the HTTP method of the request.
|
%% @doc Return the HTTP method of the request.
|
||||||
-spec method(#http_req{}) -> {http_method(), #http_req{}}.
|
-spec method(#http_req{}) -> {cowboy_http:method(), #http_req{}}.
|
||||||
method(Req) ->
|
method(Req) ->
|
||||||
{Req#http_req.method, Req}.
|
{Req#http_req.method, Req}.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue