You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/12/20 07:27:43 UTC

[GitHub] [apisix-dashboard] jinchizhou commented on a change in pull request #1067: fix: error check to ensure path id doesn't conflict body id

jinchizhou commented on a change in pull request #1067:
URL: https://github.com/apache/apisix-dashboard/pull/1067#discussion_r546334896



##########
File path: api/internal/handler/route/route_test.go
##########
@@ -754,6 +754,20 @@ func TestRoute(t *testing.T) {
 	_, err = handler.Update(ctx)
 	assert.Nil(t, err)
 
+	//sleep
+	time.Sleep(time.Duration(100) * time.Millisecond)
+	
+	// check ID discrepancy on Update
+	errRoute := &UpdateInput{}
+	errRoute.ID = "2"
+	err = json.Unmarshal([]byte(reqBody), errRoute)
+	assert.Nil(t, err)
+	ctx.SetInput(errRoute)
+	ret, err = handler.Update(ctx)
+	assert.NotNil(t, err)
+	assert.EqualError(t, err, "ID on path (2) doesn't match ID on body (1)")
+	assert.Equal(t, http.StatusBadRequest, ret.(*data.SpecCodeResponse).StatusCode)
+

Review comment:
       I think this test should support
   




----------------------------------------------------------------
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:
users@infra.apache.org