registry: improve error for invalid search endpoints
Explain that search is not supported on v2 endpoints, and include the offending endpoint in the error-message. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
14b53c6318
commit
aa59b0f5a2
2 changed files with 2 additions and 2 deletions
|
@ -42,7 +42,7 @@ func TestV1EndpointParse(t *testing.T) {
|
|||
},
|
||||
{
|
||||
address: "https://0.0.0.0:5000/v2/",
|
||||
expectedErr: "unsupported V1 version path v2",
|
||||
expectedErr: "search is not supported on v2 endpoints: https://0.0.0.0:5000/v2/",
|
||||
},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
|
|
|
@ -87,7 +87,7 @@ func validateEndpoint(endpoint *v1Endpoint) error {
|
|||
func trimV1Address(address string) (string, error) {
|
||||
trimmed := strings.TrimSuffix(address, "/")
|
||||
if strings.HasSuffix(trimmed, "/v2") {
|
||||
return "", invalidParamf("unsupported V1 version path v2")
|
||||
return "", invalidParamf("search is not supported on v2 endpoints: %s", address)
|
||||
}
|
||||
return strings.TrimSuffix(trimmed, "/v1"), nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue