Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hosts): accept url as string #1189

Merged
merged 2 commits into from
Sep 7, 2020
Merged

feat(hosts): accept url as string #1189

merged 2 commits into from
Sep 7, 2020

Conversation

Haroenv
Copy link
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
Copy link
Contributor

@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?

@@ -1,6 +1,14 @@
import { CallEnum, HostOptions, StatelessHost } from '.';

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

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
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
Contributor

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 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