Skip to content

Commit

Permalink
feat: remove trailing slash from connection URL (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar authored May 12, 2020
1 parent e68cf1a commit e3d40fe
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
### Bug Fixes
1. [#85](https://github.com/influxdata/influxdb-client-python/issues/85): Fixed a possibility to generate empty write batch
2. [#86](https://github.com/influxdata/influxdb-client-python/issues/86): BREAKING CHANGE: Fixed parameters in delete api - now delete api accepts also bucket name and org name instead of only ids
1. [#93](https://github.com/influxdata/influxdb-client-python/pull/93): Remove trailing slash from connection URL

## 1.6.0 [2020-04-17]

Expand Down
5 changes: 4 additions & 1 deletion influxdb_client/client/influxdb_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def __init__(self, url, token, debug=None, timeout=10000, enable_gzip=False, org
self.default_tags = default_tags

conf = _Configuration()
conf.host = self.url
if self.url.endswith("/"):
conf.host = self.url[:-1]
else:
conf.host = self.url
conf.enable_gzip = enable_gzip
conf.debug = debug

Expand Down
1 change: 1 addition & 0 deletions tests/test_BucketsApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def test_create_delete_bucket(self):
assert self.buckets_api.find_bucket_by_id(my_bucket.id)
assert "bucket not found" in e.value.body

@pytest.mark.skip(reason="https://github.com/influxdata/influxdb/issues/14900")
def test_find_by_name(self):
my_org = self.find_my_org()

Expand Down
13 changes: 13 additions & 0 deletions tests/test_InfluxDBClient.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import unittest

from influxdb_client import InfluxDBClient


class InfluxDBClientTest(unittest.TestCase):

def test_TrailingSlashInUrl(self):
client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org")
self.assertEqual('http://localhost:9999', client.api_client.configuration.host)

client = InfluxDBClient(url="http://localhost:9999/", token="my-token", org="my-org")
self.assertEqual('http://localhost:9999', client.api_client.configuration.host)

0 comments on commit e3d40fe

Please sign in to comment.