mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #51806 from thaJeztah/fix_err_typo
daemon/server/httputils: remove badParameterError
This commit is contained in:
@@ -114,16 +114,6 @@ type ArchiveOptions struct {
|
|||||||
Path string
|
Path string
|
||||||
}
|
}
|
||||||
|
|
||||||
type badParameterError struct {
|
|
||||||
param string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e badParameterError) Error() string {
|
|
||||||
return "bad parameter: " + e.param + "cannot be empty"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e badParameterError) InvalidParameter() {}
|
|
||||||
|
|
||||||
// ArchiveFormValues parses form values and turns them into ArchiveOptions.
|
// ArchiveFormValues parses form values and turns them into ArchiveOptions.
|
||||||
// It fails if the archive name and path are not in the request.
|
// It fails if the archive name and path are not in the request.
|
||||||
func ArchiveFormValues(r *http.Request, vars map[string]string) (ArchiveOptions, error) {
|
func ArchiveFormValues(r *http.Request, vars map[string]string) (ArchiveOptions, error) {
|
||||||
@@ -133,11 +123,11 @@ func ArchiveFormValues(r *http.Request, vars map[string]string) (ArchiveOptions,
|
|||||||
|
|
||||||
name := vars["name"]
|
name := vars["name"]
|
||||||
if name == "" {
|
if name == "" {
|
||||||
return ArchiveOptions{}, badParameterError{"name"}
|
return ArchiveOptions{}, errdefs.InvalidParameter(errors.New("bad parameter: name cannot be empty"))
|
||||||
}
|
}
|
||||||
path := r.Form.Get("path")
|
path := r.Form.Get("path")
|
||||||
if path == "" {
|
if path == "" {
|
||||||
return ArchiveOptions{}, badParameterError{"path"}
|
return ArchiveOptions{}, errdefs.InvalidParameter(errors.New("bad parameter: path cannot be empty"))
|
||||||
}
|
}
|
||||||
return ArchiveOptions{name, path}, nil
|
return ArchiveOptions{name, path}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user