aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_rest.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-09-29 11:08:59 +0200
committerLoïc Hoguin <[email protected]>2012-09-29 11:08:59 +0200
commitc326a195e0b1a8d1b8ea338ae9e98d8606895641 (patch)
treede0d27c285f812c7c144718d22d1e89b2874efcc /src/cowboy_rest.erl
parent0b82eebed654bd894802acb52697a4d4187cb228 (diff)
downloadcowboy-c326a195e0b1a8d1b8ea338ae9e98d8606895641.tar.gz
cowboy-c326a195e0b1a8d1b8ea338ae9e98d8606895641.tar.bz2
cowboy-c326a195e0b1a8d1b8ea338ae9e98d8606895641.zip
Add cowboy_req:get/2 and :set/2 private functions
They should not be used unless you have a very special need, which generally involves interacting with the internals of Cowboy.
Diffstat (limited to 'src/cowboy_rest.erl')
-rw-r--r--src/cowboy_rest.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cowboy_rest.erl b/src/cowboy_rest.erl
index ad8d62f..2f9faa8 100644
--- a/src/cowboy_rest.erl
+++ b/src/cowboy_rest.erl
@@ -58,16 +58,16 @@
-> {ok, Req} | close when Req::cowboy_req:req().
upgrade(_ListenerPid, Handler, Opts, Req) ->
try
- {Method, Req1} = cowboy_req:method(Req),
+ Method = cowboy_req:get(method, Req),
case erlang:function_exported(Handler, rest_init, 2) of
true ->
- case Handler:rest_init(Req1, Opts) of
+ case Handler:rest_init(Req, Opts) of
{ok, Req2, HandlerState} ->
service_available(Req2, #state{method=Method,
handler=Handler, handler_state=HandlerState})
end;
false ->
- service_available(Req1, #state{method=Method,
+ service_available(Req, #state{method=Method,
handler=Handler})
end
catch Class:Reason ->
@@ -693,8 +693,8 @@ is_conflict(Req, State) ->
expect(Req, State, is_conflict, false, fun put_resource/2, 409).
put_resource(Req, State) ->
- {Path, Req2} = cowboy_req:path(Req),
- put_resource(cowboy_req:set_meta(put_path, Path, Req2),
+ Path = cowboy_req:get(path, Req),
+ put_resource(cowboy_req:set_meta(put_path, Path, Req),
State, fun is_new_resource/2).
%% content_types_accepted should return a list of media types and their