Skip to content
This repository
Browse code

Added get_path/1, which will be used to get out current path

  • Loading branch information...
commit 3bd2651bd92e183334c78a7f0e2eb9d52d7295dd 1 parent 854b2c6
Yomi Colledge authored

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. +5 2 lib/chatterl/src/cwiga.erl
7 lib/chatterl/src/cwiga.erl
@@ -69,6 +69,9 @@ dispatch_requests(Req) ->
69 69 Response = gen_server:call({global,?MODULE},{Method, Path, get_content_type(Ext), Post, Req}),
70 70 Req:respond(Response).
71 71
  72 +get_path(Req) ->
  73 + [Path|_Ext] = string:tokens(Req:get(path),"."),
  74 + Path.
72 75 %%====================================================================
73 76 %% gen_server callbacks
74 77 %%====================================================================
@@ -111,8 +114,8 @@ handle_call({'GET',Url,ContentType,_Post,Req},_From,State) ->
111 114 handle_call({'DELETE',Url,ContentType,_Post,Req},_From,State) ->
112 115 Reply = handle_response(handle_request('DELETE',Url,ContentType,Req),ContentType),
113 116 {reply, Reply, State};
114   -handle_call({_,Url,ContentType,_Path,_Req},_From,State) ->
115   - Reply = send_response(error,{error("Unknown command: " ++Url, ContentType),ContentType}),
  117 +handle_call({_,_Url,ContentType,_Path,Req},_From,State) ->
  118 + Reply = send_response(error,{error("Unknown command: " ++ get_path(Req), ContentType),ContentType}),
116 119 {reply, Reply, State};
117 120 handle_call(_Request, _From, State) ->
118 121 Reply = ok,

0 comments on commit 3bd2651

Please sign in to comment.
Something went wrong with that request. Please try again.