Is it considered bad practice to perform HTTP POST without entity body?

后端 未结 6 871
粉色の甜心
粉色の甜心 2020-12-12 13:58

I need to invoke a process which doesn\'t require any input from the user, just a trigger. I plan to use POST /uri without a body to trigger the process. I want to know if t

6条回答
  •  一整个雨季
    2020-12-12 14:46

    POST is completely OK. In difference of GET with POST you are changing the state of the system (most likely your trigger is "doing" something and changing data).

    I used POST already without payload and it "feels" OK. One thing you should do when using POST without payload: Pass header Content-Length: 0. I remember problems with some proxies when I api-client didn't pass it.

提交回复
热议问题