Correct HTTP status code for existent resource, but non-existent entity?

前端 未结 3 1935
一生所求
一生所求 2021-01-01 16:45

Say the client is requesting the following URL:

/user-details?user=123

If /user-details was a non-existing resource, the corre

3条回答
  •  旧时难觅i
    2021-01-01 17:21

    The user parameter is part of the resource identifier as stated in RFC 3986, section 3.4:

    The query component contains non-hierarchical data that, along with data in the path component (Section 3.3), serves to identify a resource within the scope of the URI's scheme and naming authority

    Hence, 404/Not found is perfectly fine.

提交回复
热议问题