Skip to content

Commit

Permalink
Use Curl for posts
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Feb 3, 2009
1 parent 5aa6b21 commit 80f4e52
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/testjour/http_queue.rb
@@ -1,5 +1,5 @@
require "testjour/core_extensions/wait_for_service"
require "net/http"
require "curb"

module Testjour
class HttpQueue
Expand All @@ -8,12 +8,10 @@ class ResultOverdueError < StandardError; end
class QueueProxy

def push(queue_name, data)
self.class.with_net_http do |http|
request = Net::HTTP::Post.new("/" + queue_name.to_s)
request.form_data = { "data" => Marshal.dump(data) }
response = http.request(request)
return response.code.to_i == 200
end
c = Curl::Easy.http_post("http://0.0.0.0:#{Testjour::HttpQueue.port}/" + queue_name.to_s,
Curl::PostField.content("data", Marshal.dump(data)))

c.response_code == 200
end

def pop(queue_name)
Expand Down

0 comments on commit 80f4e52

Please sign in to comment.