ocket8888 commented on code in PR #7194:
URL: https://github.com/apache/trafficcontrol/pull/7194#discussion_r1024507202


##########
traffic_ops/testing/api/v4/profile_parameters_test.go:
##########
@@ -76,6 +76,11 @@ func TestProfileParameters(t *testing.T) {
                                        },
                                        Expectations: 
utils.CkRequest(utils.HasError(), utils.HasStatus(http.StatusBadRequest)),
                                },
+                               "BAD REQUEST when EMPTY BODY PROVIDED": {
+                                       ClientSession: TOSession,
+                                       RequestBody:   map[string]interface{}{},
+                                       Expectations:  
utils.CkRequest(utils.HasError(), utils.HasStatus(http.StatusBadRequest)),
+                               },

Review Comment:
   This doesn't actually test the behavior being fixed in this PR. [Marshalling 
an empty map appropriately produces an empty object - not an empty request 
body](https://go.dev/play/p/A4w_-aQn2HB)!



##########
traffic_ops/testing/api/v3/profile_parameters_test.go:
##########
@@ -75,6 +75,11 @@ func TestProfileParameters(t *testing.T) {
                                        }},
                                        Expectations: 
utils.CkRequest(utils.HasError(), utils.HasStatus(http.StatusBadRequest)),
                                },
+                               "BAD REQUEST when EMPTY BODY PROVIDED": {
+                                       ClientSession: TOSession,
+                                       RequestBody:   
[]tc.ProfileParameter{{}},
+                                       Expectations:  
utils.CkRequest(utils.HasError(), utils.HasStatus(http.StatusBadRequest)),
+                               },

Review Comment:
   This doesn't actually test the behavior being fixed in this PR. This a list 
of length 1 (not 0!) whose only element has the default/"zero" values for all 
of its properties. [The result when Go marshals that is, accordingly, an array 
with one object element](https://go.dev/play/p/UadnzuI9JY3).



##########
traffic_ops/testing/api/v5/profile_parameters_test.go:
##########
@@ -76,6 +76,11 @@ func TestProfileParameters(t *testing.T) {
                                        },
                                        Expectations: 
utils.CkRequest(utils.HasError(), utils.HasStatus(http.StatusBadRequest)),
                                },
+                               "BAD REQUEST when EMPTY BODY PROVIDED": {
+                                       ClientSession: TOSession,
+                                       RequestBody:   map[string]interface{}{},
+                                       Expectations:  
utils.CkRequest(utils.HasError(), utils.HasStatus(http.StatusBadRequest)),
+                               },

Review Comment:
   Same as above



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to