diff --git a/lib/restfulie/client/dsl.rb b/lib/restfulie/client/dsl.rb index 57663446..319f271c 100644 --- a/lib/restfulie/client/dsl.rb +++ b/lib/restfulie/client/dsl.rb @@ -16,7 +16,7 @@ def request(what) def response(what) response = "Restfulie::Client::Feature::#{what.to_s.classify}".constantize - @responses << response + @requests << response end def method_missing(sym, *args) @@ -26,8 +26,8 @@ def method_missing(sym, *args) end def request_flow - http_response = Parser.new(@requests).continue(self) - response = Parser.new(@responses).continue(self, http_response) + http_response = Parser.new(@requests).continue(self, nil) + # response = Parser.new(@responses).continue(self, http_response) end end @@ -46,7 +46,7 @@ def continue(*args) end @following = @stack.shift filter = current.new - debugger + # debugger filter.execute(self, *args) end diff --git a/lib/restfulie/client/feature.rb b/lib/restfulie/client/feature.rb index 6450bf79..32061877 100644 --- a/lib/restfulie/client/feature.rb +++ b/lib/restfulie/client/feature.rb @@ -110,15 +110,15 @@ def headers=(h) class BaseRequest - def execute(flow, request) - request!(request.verb, request.host, request.path, request) + def execute(flow, request, response) + request!(request.verb, request.host, request.path, request, flow) end # Executes a request against your server and return a response instance. # * method: :get,:post,:delete,:head,:put # * path: '/posts' # * args: payload: 'some text' and/or headers: {'Accept' => '*/*', 'Content-Type' => 'application/atom+xml'} - def request!(method, host, path, request, *args) + def request!(method, host, path, request, flow, *args) headers = request.default_headers.merge(args.extract_options!) unless host.user.blank? && host.password.blank? headers["Authorization"] = "Basic " + ["#{host.user}:#{host.password}"].pack("m").delete("\r\n") @@ -139,6 +139,8 @@ def request!(method, host, path, request, *args) response = e end + flow.continue(request, response) + # Restfulie::Client::Response::EnhanceResponse.new(response_handler).parse(host, path, http_request, self, response, method) end