Skip to content

Commit

Permalink
Remove trainling slashes from URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
SupraSummus committed Dec 2, 2023
1 parent 0adcbe1 commit 6170403
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions pysolr.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,11 @@ def _select(self, params, handler=None):

if len(params_encoded) < 1024:
# Typical case.
path = "%s/?%s" % (handler, params_encoded)
path = "%s?%s" % (handler, params_encoded)
return self._send_request("get", path)
else:
# Handles very long queries by submitting as a POST.
path = "%s/" % handler
path = "%s" % handler
headers = {
"Content-type": "application/x-www-form-urlencoded; charset=utf-8"
}
Expand Down Expand Up @@ -534,7 +534,7 @@ def _update(
path_handler = "select"
query_vars.append("qt=%s" % safe_urlencode(handler, True))

path = "%s/" % path_handler
path = "%s" % path_handler

if commit is None:
commit = self.always_commit
Expand Down Expand Up @@ -1261,11 +1261,11 @@ def ping(self, handler="admin/ping", **kwargs):

if len(params_encoded) < 1024:
# Typical case.
path = "%s/?%s" % (handler, params_encoded)
path = "%s?%s" % (handler, params_encoded)
return self._send_request("get", path)
else:
# Handles very long queries by submitting as a POST.
path = "%s/" % handler
path = "%s" % handler
headers = {
"Content-type": "application/x-www-form-urlencoded; charset=utf-8"
}
Expand Down
14 changes: 7 additions & 7 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def test_search(self):
self.assertEqual(len(results), 3)
# search should default to 'select' handler
args, kwargs = self.solr._send_request.call_args
self.assertTrue(args[1].startswith("select/?"))
self.assertTrue(args[1].startswith("select?"))

results = self.solr.search("example")
self.assertEqual(len(results), 2)
Expand Down Expand Up @@ -627,7 +627,7 @@ def test_more_like_this(self):
self.assertEqual(len(results), 0)
# more_like_this should default to 'mlt' handler
args, kwargs = self.solr._send_request.call_args
self.assertTrue(args[1].startswith("mlt/?"))
self.assertTrue(args[1].startswith("mlt?"))

# more_like_this should support custom handlers
with self.assertRaises(SolrError):
Expand Down Expand Up @@ -655,7 +655,7 @@ def test_suggest_terms(self):
)
# suggest_terms should default to 'mlt' handler
args, kwargs = self.solr._send_request.call_args
self.assertTrue(args[1].startswith("terms/?"))
self.assertTrue(args[1].startswith("terms?"))

# suggest_terms should support custom handlers
with self.assertRaises(SolrError):
Expand Down Expand Up @@ -732,7 +732,7 @@ def test_add(self):
)
# add should default to 'update' handler
args, kwargs = self.solr._send_request.call_args
self.assertTrue(args[1].startswith("update/?"))
self.assertTrue(args[1].startswith("update?"))

self.assertEqual(len(self.solr.search("doc")), 5)
self.assertEqual(len(self.solr.search("example")), 3)
Expand Down Expand Up @@ -848,7 +848,7 @@ def test_delete(self):
self.solr.delete(id="doc_1", commit=True)
# delete should default to 'update' handler
args, kwargs = self.solr._send_request.call_args
self.assertTrue(args[1].startswith("update/?"))
self.assertTrue(args[1].startswith("update?"))

self.assertEqual(len(self.solr.search("doc")), 2)
self.assertEqual(len(self.solr.search("type_s:parent")), 2)
Expand Down Expand Up @@ -915,7 +915,7 @@ def test_commit(self):
self.solr.commit()
# commit should default to 'update' handler
args, kwargs = self.solr._send_request.call_args
self.assertTrue(args[1].startswith("update/?"))
self.assertTrue(args[1].startswith("update?"))
self.assertEqual(len(self.solr.search("doc")), 4)

def test_can_handles_default_commit_policy(self):
Expand Down Expand Up @@ -954,7 +954,7 @@ def test_optimize(self):
self.solr.optimize()
# optimize should default to 'update' handler
args, kwargs = self.solr._send_request.call_args
self.assertTrue(args[1].startswith("update/?"))
self.assertTrue(args[1].startswith("update?"))
self.assertEqual(len(self.solr.search("doc")), 4)

# optimize should support custom handlers
Expand Down

0 comments on commit 6170403

Please sign in to comment.