Skip to content

feat(hosts): accept url as string#1189

Merged
Haroenv merged 2 commits intomasterfrom
feat/hosts-accept-string
Sep 7, 2020
Merged

feat(hosts): accept url as string#1189
Haroenv merged 2 commits intomasterfrom
feat/hosts-accept-string

Conversation

@Haroenv
Copy link
Copy Markdown
Contributor

@Haroenv Haroenv commented Sep 7, 2020

In v3 the API was hosts: string[]. It's easy to miss out on this in the migration guide, and it's also simpler to write just a string in the general case

fixes #1188

In v3 the API was `hosts: string[]`. It's easy to miss out on this in the migration guide, and it's also simpler to write just a string in the general case

fixes #1188
@Haroenv Haroenv requested review from redox and yannickcr September 7, 2020 09:36
Copy link
Copy Markdown

@redox redox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the protocol, what do you think?

export function createStatelessHost(options: HostOptions): StatelessHost {
if (typeof options === 'string') {
return {
protocol: 'https',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to force the protocol? I think I would rather keep not set the protocol key and let the regular business logic deal with it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only place where protocol is set. If you set { url: xxx } the protocol will also be https. If you want a custom protocol you can use the object form as normal. Don't you think that most cases would be using https?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think https is a reasonable default here.
Also FMPOV the DX is better if createStatelessHost({url: xxx}) and createStatelessHost(xxx) have the same behavior

@Haroenv Haroenv requested a review from redox September 7, 2020 12:29
yannickcr
yannickcr previously approved these changes Sep 7, 2020
@Haroenv Haroenv force-pushed the feat/hosts-accept-string branch from f23fbc9 to a341934 Compare September 7, 2020 12:43
@Haroenv Haroenv merged commit 4daf32c into master Sep 7, 2020
@Haroenv Haroenv deleted the feat/hosts-accept-string branch September 7, 2020 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

We should support passing an array of string for the hosts options

3 participants