mirror of
https://github.com/docker/cli.git
synced 2026-01-13 18:22:35 +03:00
fix some types on errors and form
Signed-off-by: kaiwentan <kaiwentan@harmonycloud.cn> Upstream-commit: ac9c47e26f57a0fa2fed95a1fb1bf6c9410a3b60 Component: engine
This commit is contained in:
@@ -16,7 +16,7 @@ func (e apiError) HTTPErrorStatusCode() int {
|
||||
|
||||
// NewErrorWithStatusCode allows you to associate
|
||||
// a specific HTTP Status Code to an error.
|
||||
// The Server will take that code and set
|
||||
// The server will take that code and set
|
||||
// it as the response status.
|
||||
func NewErrorWithStatusCode(err error, code int) error {
|
||||
return apiError{err, code}
|
||||
|
||||
@@ -28,7 +28,7 @@ type inputValidationError interface {
|
||||
IsValidationError() bool
|
||||
}
|
||||
|
||||
// GetHTTPErrorStatusCode retrieves status code from error message
|
||||
// GetHTTPErrorStatusCode retrieves status code from error message.
|
||||
func GetHTTPErrorStatusCode(err error) int {
|
||||
if err == nil {
|
||||
logrus.WithFields(logrus.Fields{"error": err}).Error("unexpected HTTP error handling")
|
||||
|
||||
@@ -15,7 +15,7 @@ func BoolValue(r *http.Request, k string) bool {
|
||||
}
|
||||
|
||||
// BoolValueOrDefault returns the default bool passed if the query param is
|
||||
// missing, otherwise it's just a proxy to boolValue above
|
||||
// missing, otherwise it's just a proxy to boolValue above.
|
||||
func BoolValueOrDefault(r *http.Request, k string, d bool) bool {
|
||||
if _, ok := r.Form[k]; !ok {
|
||||
return d
|
||||
|
||||
Reference in New Issue
Block a user