Skip to content
Created by

Get Requests and Caching

Connect supports HTTP GET for idempotent, side-effect-free RPCs. This makes the requests cacheable by browsers, CDNs, and intermediate proxies.

First, configure your server to handle HTTP GET. See the server-side guide for your backend:

To opt a procedure into GET, mark it as side-effect-free with MethodOptions.IdempotencyLevel:

service ElizaService {
rpc Say(SayRequest) returns (SayResponse) {
option idempotency_level = NO_SIDE_EFFECTS;
}
}

GET requests are off by default. Opt in by setting getConfiguration on ProtocolClientConfig:

val config = ProtocolClientConfig(
getConfiguration = GETConfiguration.Enabled,
...
)

GETConfiguration.EnabledWithFallback(maxMessageBytes) is also available; it sends a GET only when the encoded message fits within maxMessageBytes and falls back to POST otherwise.