check status code before converting to json
@@ -270,16 +270,17 @@ func GetRequestsUndo(ctx gobdd.Context, version string, operationID string) (fun
if err != nil {
t.Fatalf("%v", err)
}
- responseJSON, err := toJSON(response[0])
- if err != nil {
- t.Fatalf("%v", err)
- }
// No object is created when it's a Bad Request
if responseStatusCode >= 400 {
return
}
+ responseJSON, err := toJSON(response[0])
+ if err != nil {
+ t.Fatalf("%v", err)
+ }
+
// enable unstable operation
configInterface := undoClientInterface.MethodByName("GetConfig").Call(nil)[0]
if configInterface.MethodByName("IsUnstableOperation").Call([]reflect.Value{reflect.ValueOf(undo.Undo.OperationID)})[0].Bool() {
