api: provide more detail on ACL bootstrap request error (#14629)

This commit is contained in:
Luiz Aoqui
2022-09-20 21:20:04 -04:00
committed by GitHub
parent 54474a9534
commit ddeeb1040e
2 changed files with 5 additions and 1 deletions

3
.github/14629.txt vendored Normal file
View File

@@ -0,0 +1,3 @@
```release-note:improvement
api: return a more descriptive error when /v1/acl/bootstrap fails to decode request body
```

View File

@@ -1,6 +1,7 @@
package agent
import (
"fmt"
"net/http"
"strings"
@@ -142,7 +143,7 @@ func (s *HTTPServer) ACLTokenBootstrap(resp http.ResponseWriter, req *http.Reque
if req.ContentLength != 0 {
if err := decodeBody(req, &args); err != nil {
return nil, CodedError(400, err.Error())
return nil, CodedError(400, fmt.Sprintf("failed to decode request body: %s", err))
}
}