github connectrpc/connect-go v1.7.0

latest releases: v1.17.0, v1.16.2, v1.16.1...
19 months ago

What's Changed

As of this release, the Connect protocol supports performing idempotent, side-effect free requests using HTTP GETs. This makes it easier to cache responses in the browser, on your CDN, or in proxies and other middleboxes.

Note
This functionality is only supported when using the Connect protocol—using a Connect client with a Connect server. When using grpc-go clients, or connect-go clients configured with the WithGRPC or WithGRPCWeb options, all requests will continue to be HTTP POSTs.

To opt into GET support for a given Protobuf RPC, you must mark it as being side-effect free using the MethodOptions.IdempotencyLevel option:

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

With this schema change, handlers will automatically support both GET and POST requests for this RPC. However, clients will continue to use POST requests by default, even when GETs are possible. To make clients use GETs for side effect free RPCs, use the WithHTTPGet option:

client := elizav1connect.NewElizaServiceClient(
    http.DefaultClient,
    connect.WithHTTPGet(),
)

This functionality is not yet supported by other Connect implementations (including connect-es), but hang tight! We're working on it. For more information, please check the full documentation.

Enhancements

Bugfixes

  • Fix WithCompression to match docs by @jhump in #493

Full Changelog: v1.6.0...v1.7.0

Don't miss a new connect-go release

NewReleases is sending notifications on new releases.