mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: update go-ceph version to v0.11.0
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
87beaac25b
commit
56ac143450
17
vendor/github.com/ceph/go-ceph/internal/commands/response.go
generated
vendored
17
vendor/github.com/ceph/go-ceph/internal/commands/response.go
generated
vendored
@ -110,6 +110,23 @@ func (r Response) NoBody() Response {
|
||||
return r
|
||||
}
|
||||
|
||||
// EmptyBody is similar to NoBody but also accepts an empty JSON object.
|
||||
func (r Response) EmptyBody() Response {
|
||||
if !r.Ok() {
|
||||
return r
|
||||
}
|
||||
if len(r.body) != 0 {
|
||||
d := map[string]interface{}{}
|
||||
if err := json.Unmarshal(r.body, &d); err != nil {
|
||||
return Response{r.body, r.status, err}
|
||||
}
|
||||
if len(d) != 0 {
|
||||
return Response{r.body, r.status, ErrBodyNotEmpty}
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// NoData asserts that the input response has no status or body values.
|
||||
func (r Response) NoData() Response {
|
||||
return r.NoStatus().NoBody()
|
||||
|
Reference in New Issue
Block a user