http HEAD vs GET performance

后端 未结 8 816
无人共我
无人共我 2020-11-30 17:57

I am setting-up a REST web service that just need to answer YES or NO, as fast as possible.

Designing a HEAD service seems the best way to do it but I would like to

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 18:44

    I strongly discourage this kind of approach.

    A RESTful service should respect the HTTP verbs semantics. The GET verb is meant to retrieve the content of the resource, while the HEAD verb will not return any content and may be used, for example, to see if a resource has changed, to know its size or its type, to check if it exists, and so on.

    And remember : early optimization is the root of all evil.

提交回复
热议问题