feat: switch to using actions/http-client#94
Merged
bharathkkb merged 7 commits intomainfrom Feb 14, 2022
Merged
Conversation
sethvargo
reviewed
Feb 11, 2022
sethvargo
reviewed
Feb 11, 2022
src/version-util.ts
Outdated
| throw new Error(`Failed to retrieve gcloud SDK version, invalid response body: ${body}`); | ||
| export async function getGcloudVersion(url: string): Promise<string> { | ||
| const http = new HttpClient(userAgentString, undefined, { allowRetries: true, maxRetries: 3 }); | ||
| const res = await http.getJson<{ version: string }>(url); |
Contributor
There was a problem hiding this comment.
It doesn't look like the library actually checks 400s or 500s. I think we need to get the body first, then check the response, then print the body on error. Otherwise we risk swallowing the message.
Contributor
Author
There was a problem hiding this comment.
The getJson does check here but since we want op I will switch to the other approach.
Contributor
There was a problem hiding this comment.
Oh that's a weird API. The README specifically states that errors are not checked. And it looks like that's true for non-JSON responses.
Contributor
Author
There was a problem hiding this comment.
getJson could be useful for us if it threw an error for non-JSON responses. I will open an issue but doubt it will happen since its a breaking change for them.
sethvargo
approved these changes
Feb 12, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
switch to making requests via
actions/http-clientwhich respects proxy env vars