HTTP 200 or 404 for empty list?

前端 未结 4 1645
旧巷少年郎
旧巷少年郎 2021-02-13 12:30

I know this is a fairly common question, but I haven\'t found an answer that satisfies me.

I\'ve been using django rest framework for a while now, but this is mostly irr

4条回答
  •  被撕碎了的回忆
    2021-02-13 13:09

    200 simply means the request has succeeded. The information returned with the response is dependent on the method used in the request, for example: GET an entity corresponding to the requested resource is sent in the response;

    HEAD the entity-header fields corresponding to the requested resource are sent in the response without any message-body;

    POST an entity describing or containing the result of the action;

    TRACE an entity containing the request message as received by the end server. 404 - The server has not found anything matching the Request-URI - In this case I think it means we did not find the page that articles would have been listed on. So 200 it is. - but perhaps understand what is being returned and format a message that 0 article have been returned.

提交回复
热议问题