apisix-dashboard icon indicating copy to clipboard operation
apisix-dashboard copied to clipboard

bug: manager-api supported `POST` method for consumer

Open idbeta opened this issue 6 years ago • 4 comments

Bug report

Describe the bug

manager-api supported POST method for consumer. but it should not support the POST method for consumer, the same as APISIX's adminapi.

{
			caseDesc: "create consumers with post method",
			Object:   MangerApiExpect(t),
			Path:     "/apisix/admin/consumers",
			Method:   http.MethodPost,
			Body: `{
				"username":"case_9",
				"desc": "new consumer",
				"create_time": 1602883670,
				"update_time": 1602893670
		   }`,
			Headers:      map[string]string{"Authorization": token},
			ExpectStatus: http.StatusMethodNotAllowed,
		},

idbeta avatar Nov 23 '20 05:11 idbeta

Hi, @idbeta. I had lookup the code in apisix-dashboard and apisix.

apisix will return 405 and not supported POST method for consumer apisix-dashboard will create a new consumer.

So I think apisix-dashboard should forbid POST and merge Create and Update into a function which was called byPUT method.

starsz avatar Nov 23 '20 13:11 starsz

The frontend will use put instead of post now.

juzhiyuan avatar Nov 23 '20 15:11 juzhiyuan

So I think apisix-dashboard should forbid POST and merge Create and Update into a function which was called byPUT method.

agree with this. @starsz would like to fix this issue?

membphis avatar Nov 24 '20 03:11 membphis

So I think apisix-dashboard should forbid POST and merge Create and Update into a function which was called byPUT method.

agree with this. @starsz would like to fix this issue?

My pleasure, please assign to me.

starsz avatar Nov 24 '20 03:11 starsz