Is the HTTP QUERY method safe, idempotent, and cacheable according to the HTTP specification?

Asked 21 days ago Updated 18 days ago 123 views

1 Answer


1

Yes. According to the HTTP specification for the newly standardized QUERY method (RFC 10008), the QUERY method is:

  • Safe: Yes — A QUERY request is defined as a safe method, meaning it does not request or expect changes to the state of the target resource. Servers may still perform incidental actions such as logging, but the resource itself is not intended to be modified.
  • Idempotent: Yes — Sending the same QUERY request multiple times has the same intended effect as sending it once. This allows clients to automatically retry requests after connection failures without risking unintended state changes. 
  • Cacheable: Yes — Responses to QUERY requests are explicitly cacheable. Unlike GET, however, caches must include the request body (and related metadata) as part of the cache key, since the body determines the query being executed. 
Property QUERY
Safe Yes
Idempotent Yes
Cacheable Yes

The motivation behind QUERY is to provide a method that combines the benefits of GET and POST:

  • Like POST, it carries a request body, making it suitable for complex or large query parameters.
  • Like GET, it is safe, idempotent, and cacheable, enabling automatic retries and efficient caching. 

Write Your Answer