Skip to content

Commit

Permalink
its all one big stack
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermesilveira committed Oct 21, 2010
1 parent 9162104 commit f4c9a07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/restfulie/client/dsl.rb
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -46,7 +46,7 @@ def continue(*args)
end
@following = @stack.shift
filter = current.new
debugger
# debugger
filter.execute(self, *args)
end

Expand Down
8 changes: 5 additions & 3 deletions lib/restfulie/client/feature.rb
Expand Up @@ -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.
# * <tt>method: :get,:post,:delete,:head,:put</tt>
# * <tt>path: '/posts'</tt>
# * <tt>args: payload: 'some text' and/or headers: {'Accept' => '*/*', 'Content-Type' => 'application/atom+xml'}</tt>
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")
Expand All @@ -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
Expand Down

0 comments on commit f4c9a07

Please sign in to comment.