File tree 3 files changed +36
-0
lines changed
test/lib/Elastica/Test/Transport
3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1
1
CHANGES
2
2
3
+ 2014-03-11
4
+ - Fixed request body reuse in http transport
5
+
3
6
2014-03-08
4
7
- Release v1.0.1.1
5
8
- Enable goecluster-facet again as now compatible with elasticsearch 1.0 on travis
Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ public function exec(Request $request, array $params)
112
112
$ content = str_replace ('\/ ' , '/ ' , $ content );
113
113
114
114
curl_setopt ($ conn , CURLOPT_POSTFIELDS , $ content );
115
+ } else {
116
+ curl_setopt ($ conn , CURLOPT_POSTFIELDS , '' );
115
117
}
116
118
117
119
curl_setopt ($ conn , CURLOPT_NOBODY , $ httpMethod == 'HEAD ' );
Original file line number Diff line number Diff line change 4
4
5
5
use Elastica \Client ;
6
6
use Elastica \Document ;
7
+ use Elastica \Query ;
8
+ use Elastica \ResultSet ;
7
9
use Elastica \Test \Base as BaseTest ;
8
10
use Elastica \Exception \ResponseException ;
9
11
@@ -180,4 +182,33 @@ public function testWithoutProxy()
180
182
$ this ->assertEquals (200 , $ transferInfo ['http_code ' ]);
181
183
}
182
184
185
+ public function testBodyReuse ()
186
+ {
187
+ $ client = new Client ();
188
+
189
+ $ index = $ client ->getIndex ('elastica_body_reuse_test ' );
190
+
191
+ $ index ->create (array (), true );
192
+
193
+ $ type = $ index ->getType ('test ' );
194
+ $ type ->addDocument (new Document (1 , array ('test ' => 'test ' )));
195
+
196
+ $ index ->refresh ();
197
+
198
+ $ resultSet = $ index ->search (array (
199
+ 'query ' => array (
200
+ 'query_string ' => array (
201
+ 'query ' => 'pew pew pew ' ,
202
+ ),
203
+ ),
204
+ ));
205
+
206
+ $ this ->assertEquals (0 , $ resultSet ->getTotalHits ());
207
+
208
+ $ response = $ index ->request ('/_search ' , 'POST ' );
209
+ $ resultSet = new ResultSet ($ response , Query::create (array ()));
210
+
211
+ $ this ->assertEquals (1 , $ resultSet ->getTotalHits ());
212
+ }
213
+
183
214
}
You can’t perform that action at this time.
0 commit comments