lib/em-http/client.rb in tmm1-em-http-request-0.1.0 vs lib/em-http/client.rb in tmm1-em-http-request-0.1.1
- old
+ new
@@ -92,11 +92,15 @@
HTTP_REQUEST_HEADER % [method.to_s.upcase, encode_query(path, query)]
end
def encode_query(path, query)
return path unless query
- path + "?" + query.map { |k, v| encode_param(k, v) }.join('&')
+ if query.kind_of? String
+ return "#{path}?#{query}"
+ else
+ return path + "?" + query.map { |k, v| encode_param(k, v) }.join('&')
+ end
end
# URL encodes query parameters:
# single k=v, or a URL encoded array, if v is an array of values
def encode_param(k, v)
@@ -232,10 +236,10 @@
def on_body_data(data)
@response << data
end
def unbind
- (@state == :finished) ? succeed : fail
+ (@state == :finished) ? succeed(self) : fail
close_connection
end
#
# Response processing
\ No newline at end of file