mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Add a private cowboy_req function to create a Req object
Private means you must not used it. It's meant for internal use.
This commit is contained in:
parent
c1f5a2acb2
commit
6dbc1f9ef9
3 changed files with 23 additions and 13 deletions
|
@ -42,6 +42,7 @@
|
|||
-module(cowboy_req).
|
||||
|
||||
%% Request API.
|
||||
-export([new/9]).
|
||||
-export([method/1]).
|
||||
-export([version/1]).
|
||||
-export([peer/1]).
|
||||
|
@ -115,6 +116,20 @@
|
|||
|
||||
%% Request API.
|
||||
|
||||
%% @doc Create a new HTTP Req object.
|
||||
%%
|
||||
%% This function takes care of setting the owner's pid to self().
|
||||
%% @private
|
||||
-spec new(inet:socket(), module(), keepalive | close,
|
||||
cowboy_http:method(), cowboy_http:version(), binary(), binary(),
|
||||
undefined | fun(), undefined | {fun(), atom()})
|
||||
-> req().
|
||||
new(Socket, Transport, Connection, Method, Version, Path, Qs,
|
||||
OnResponse, URLDecode) ->
|
||||
#http_req{socket=Socket, transport=Transport, connection=Connection,
|
||||
pid=self(), method=Method, version=Version, path=Path, raw_qs=Qs,
|
||||
onresponse=OnResponse, urldecode=URLDecode}.
|
||||
|
||||
%% @doc Return the HTTP method of the request.
|
||||
-spec method(Req) -> {cowboy_http:method(), Req} when Req::req().
|
||||
method(Req) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue