contentful / contentful-sdk-core

Core modules for the Contentful JS SDKs
MIT License
22 stars 20 forks source link

Throw an error when malformed host is passed in `CreateHttpClientParams` to `createHttpClient` #439

Open catchergeese opened 8 months ago

catchergeese commented 8 months ago

Hi 👋

I use JavaScript Contentful SDK. It allows to specify host param. I use it to create either a delivery or preview Contentful client.

Recently, I accidentally passed https://preview.contentful.com instead of preview.contentful.com when moving from custom HTTP client to JS CTF SDK. While in the hindsight it seems like an obvious mistake of mine, it took some time to discover.

Do you think it would make sense to throw an Error when host param is passed and it doesn't match the expected format here? Currently, it fails silently.