rsolr-patron 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rsolr-patron.rb +3 -2
- data/spec/rsolr-patron_spec.rb +2 -43
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/rsolr-patron.rb
CHANGED
@@ -46,12 +46,13 @@ module RSolr::Patron
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def get(url)
|
49
|
-
response = connection.get url
|
49
|
+
response = connection.get url, {"Expect" => ""}
|
50
|
+
|
50
51
|
[response.body, response.status, response.status_line]
|
51
52
|
end
|
52
53
|
|
53
54
|
def post(url, data, headers={})
|
54
|
-
response = connection.post url, data, headers
|
55
|
+
response = connection.post url, data, headers.merge("Expect" => "")
|
55
56
|
[response.body, response.status, response.status_line]
|
56
57
|
end
|
57
58
|
|
data/spec/rsolr-patron_spec.rb
CHANGED
@@ -33,7 +33,7 @@ describe RSolr::Patron do
|
|
33
33
|
it "calls #get on the patron connection with the appropriate data" do
|
34
34
|
connection = RSolr::Patron::Connection.new
|
35
35
|
connection.send(:connection) \
|
36
|
-
.should_receive(:get).with("/solr/search?q=foo") \
|
36
|
+
.should_receive(:get).with("/solr/search?q=foo", "Expect" => "") \
|
37
37
|
.and_return mock("body", :body => "", :status => 200, :status_line => "OK")
|
38
38
|
connection.request("/search", :q => "foo")
|
39
39
|
end
|
@@ -43,51 +43,10 @@ describe RSolr::Patron do
|
|
43
43
|
it "calls #post on the patron connection" do
|
44
44
|
connection = RSolr::Patron::Connection.new
|
45
45
|
connection.send(:connection).should_receive(:post) \
|
46
|
-
.with("/solr/search", "q=query", {"Content-Type"=>"application/x-www-form-urlencoded"}) \
|
46
|
+
.with("/solr/search", "q=query", {"Content-Type"=>"application/x-www-form-urlencoded", "Expect" => ""}) \
|
47
47
|
.and_return mock("body", :body => "", :status => 200, :status_line => "OK")
|
48
48
|
connection.request("/search", {:q => "query"}, :method => :post)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
# context '#request' do
|
53
|
-
# it 'should forward simple, non-data calls to #get' do
|
54
|
-
|
55
|
-
# EM.run do
|
56
|
-
|
57
|
-
# EM.add_timer(1) do
|
58
|
-
# EM.stop
|
59
|
-
# end
|
60
|
-
|
61
|
-
# EM::MockHttpRequest.pass_through_requests = false
|
62
|
-
# body = <<-EOM
|
63
|
-
# HTTP/1.1 200 OK
|
64
|
-
# Date: Mon, 16 Nov 2009 20:39:15 GMT
|
65
|
-
# Expires: -1
|
66
|
-
# Cache-Control: private, max-age=0
|
67
|
-
# Content-Type: text/xml; charset=utf-8
|
68
|
-
# Connection: close
|
69
|
-
|
70
|
-
# <?xml version="1.0" encoding="UTF-8"?>
|
71
|
-
# <response>
|
72
|
-
# <lst name="responseHeader"><int name="status">0</int><int name="QTime">1</int><lst name="params"><str name="q">a</str></lst></lst><result name="response" numFound="0" start="0"/>
|
73
|
-
# </response>
|
74
|
-
# EOM
|
75
|
-
# EM::MockHttpRequest.register 'http://127.0.0.1:8983/solr/select?q=a', :get, body
|
76
|
-
|
77
|
-
# Fiber.new do
|
78
|
-
# begin
|
79
|
-
# http = new_connection
|
80
|
-
# resp = http.request('/select', :q=>'a')
|
81
|
-
# resp[:status_code].should == 200
|
82
|
-
# rescue Exception => ex
|
83
|
-
# puts ex.message
|
84
|
-
# puts ex.backtrace.join("\n")
|
85
|
-
# end
|
86
|
-
# EM.stop
|
87
|
-
# end.resume
|
88
|
-
# end
|
89
|
-
|
90
|
-
# end
|
91
|
-
# end
|
92
|
-
|
93
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsolr-patron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Witmer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-16 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|