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
Add additional API functionality #39
Conversation
cabf149
to
ba8070c
Compare
} | ||
|
||
// HandleHTTPError parses a http.Response into a HTTPError. | ||
func HandleHTTPError(resp *http.Response) error { |
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.
I am not in love with this name, I am open to suggestions on a better one.
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.
I think it's fine! Ideally, no integrators will ever need to call this directly, since all the other higher-level API methods call this internally on non-HTTP 200 statuses. However, I understand we need this from cli/cli
?
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.
Yeah, there are numerous places in cli/cli
that call api.HandleHTTPError
directly rather than making requests through an api.Client
interface.
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.
This looks good! Thank you for the hard work 🙇
} | ||
|
||
// HandleHTTPError parses a http.Response into a HTTPError. | ||
func HandleHTTPError(resp *http.Response) error { |
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.
I think it's fine! Ideally, no integrators will ever need to call this directly, since all the other higher-level API methods call this internally on non-HTTP 200 statuses. However, I understand we need this from cli/cli
?
This PR adds additional API functionality that is necessary for
gh
to utilizego-gh
.optionsNeedResolution
to avoid unnecessary config loadingapi.HandleHTTPError
to allow users access to use our error handlingRESTClient.Raw
function to allow users direct access to an http responsepkg/api/http.go
topkg/api/errors.go
to more accurately reflect its contentsBased on top of #30
Corresponding
gh
PR cli/cli#5614 that uses these changes.cc cli/cli#5560