weaviate / typescript-client

Official Weaviate TypeScript Client
https://www.npmjs.com/package/weaviate-client
BSD 3-Clause "New" or "Revised" License
57 stars 21 forks source link

Connection fails when user-provided host URL contains the scheme #87

Closed thomashacker closed 9 months ago

thomashacker commented 10 months ago

Connection fails when user-provided host URL contains the scheme

Issue:

When initializing the Weaviate Client, if a user provides a host URL that already contains a scheme (e.g., https), the connection fails. This is because both the host and scheme are concatenated in the code.

Expected Behavior:

The client should handle cases where the scheme might already exist in the provided host URL. The goal is consistent behavior in both Python and Typescript clients. For instance, a user should be able to use the same URL for both the Python and TypeScript clients without adjusting the URL format for each.

How to Reproduce:

# Python Example

client = weaviate.Client(url = "https://some-endpoint.weaviate.network")
// Works

const client: WeaviateClient = weaviate.client({
  scheme: 'https', host: 'some-endpoint.weaviate.network'
});
// Fails

const client: WeaviateClient = weaviate.client({
  scheme: 'https', host: 'https://some-endpoint.weaviate.network'
});