HTTP Get with 204 No Content: Is that normal

后端 未结 5 652
没有蜡笔的小新
没有蜡笔的小新 2021-01-30 10:11

Is it a normal occurrence for an HTTP GET Request to have a response with status code 204 - No Content? Like, is this semantically correct concerni

5条回答
  •  长情又很酷
    2021-01-30 10:48

    I use GET/204 with a RESTful collection that is a positional array of known fixed length but with holes.

    GET /items
        200: ["a", "b", null]
    
    GET /items/0
        200: "a"
    
    GET /items/1
        200: "b"
    
    GET /items/2
        204:
    
    GET /items/3
        404: Not Found
    

提交回复
热议问题