Skip to content

Commit 88e4783

Browse files
authored
Polling Delete Return Type (#64)
When this responds with GONE, then it should return an empty object, not an error message. Implements #49
1 parent 138f23b commit 88e4783

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pkg/broker/handlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ func handlePollServiceInstance(w http.ResponseWriter, r *http.Request, params ht
651651
}
652652

653653
if !entry.Exists() {
654-
jsonError(w, errors.NewResourceGoneError("service instance does not exist"))
654+
JSONResponse(w, http.StatusGone, struct{}{})
655655
return
656656
}
657657

test/unit/util/api.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,14 +568,14 @@ func MustDeleteServiceInstance(t *testing.T, name string, req *api.CreateService
568568
func MustPollServiceInstanceForDeletion(t *testing.T, name string, rsp *api.CreateServiceInstanceResponse) {
569569
callback := func() error {
570570
// When polling for deletion, it will start as OK (as per MustPollServiceInstanceForCompletion)
571-
// however will finally respond with Gone.
572-
apiError := &api.Error{}
573-
if err := Get(ServiceInstancePollURI(name, PollServiceInstanceQuery(nil, rsp)), http.StatusGone, apiError); err != nil {
571+
// however will finally respond with Gone. When it does, assert the response is an empty object.
572+
var response map[string]interface{}
573+
574+
if err := Get(ServiceInstancePollURI(name, PollServiceInstanceQuery(nil, rsp)), http.StatusGone, &response); err != nil {
574575
return err
575576
}
576577

577-
// Assert that the correct error message is given.
578-
Assert(t, apiError.Error == api.ErrorResourceGone)
578+
Assert(t, len(response) == 0)
579579

580580
return nil
581581
}

0 commit comments

Comments
 (0)