-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Remove request and request-promise-native in favour of got #3974
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not node-fetch
? (we are already using that)
Because I think that got's API is better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
for (const detectorClass of this.registry) { | ||
const detector = new detectorClass(cluster); | ||
return [detector.key, await detector.detect()] as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What means as const
and why do we need it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions
It is the way to say that you want a tuple of distinct types instead of an array of the union of all possible types.
return Object.fromEntries( | ||
iter.map( | ||
Object.entries(results), | ||
([key, { value }]) => [key, value] | ||
) | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need iter.map
here? Is it different somehow from:
return Object.fromEntries(
Object.entries(results).map(([key, { value }]) => [key, value])
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't allocate a new array. That is all (since fromEntries
wants an iterable). I can change it if you would like.
Good point btw. Or just use |
@Nokel81 I meant that we are using https://github.com/lensapp/lens/blob/master/src/common/k8s-api/json-api.ts#L25 |
We are already using |
@jakolehm Here is a comparison between the two (yes I admit it is from the GOT side) https://github.com/sindresorhus/got#comparison |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
I have been using got in other projects and it's fine choice but does not really warrant yet-another library included if we already have node-fetch. I'm fine with this PR because it removes deprecated |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
16143f7
to
e0f66e6
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Signed-off-by: Sebastian Malton <[email protected]>
Conflicts have been resolved. A maintainer will review the pull request shortly. |
I am going to close this PR, instead move to |
Signed-off-by: Sebastian Malton [email protected]
fixes #459