okaybase commented on a change in pull request #374:
URL:
https://github.com/apache/apisix-ingress-controller/pull/374#discussion_r614023947
##########
File path: pkg/apisix/resource_test.go
##########
@@ -74,3 +75,18 @@ func TestItemConvertRoute(t *testing.T) {
assert.Equal(t, r.Methods[1], "POST")
assert.Equal(t, r.Name, "unknown")
}
+
+func TestRouteVarsUnmarshalJSONCompatibility(t *testing.T) {
+ var route v1.Route
+ data := `{"vars":{}}`
+ err := json.Unmarshal([]byte(data), &route)
+ assert.Nil(t, err)
+
+ data = `{"vars":{"a":"b"}}`
+ err = json.Unmarshal([]byte(data), &route)
+ assert.Equal(t, err.Error(), "unexpected non-empty object")
+
+ data = `{"vars":[]}`
+ err = json.Unmarshal([]byte(data), &route)
+ assert.Nil(t, err)
Review comment:
The test case has been added.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]