Skip to content

v5.1.0: New HTTPClient interface

Compare
Choose a tag to compare
@spenczar spenczar released this 24 Jan 00:26
· 599 commits to main since this release

Release v5.1.0 improves the flexibility of client constructors. It also fixes some typos, fixes a bug in the generator, and makes minor performance improvements.

Generated client constructors now accept an interface, type HTTPClient interface { Do(*http.Request) (*http.Response, error) } instead of the concrete type *http.Client. This lets users provide clients that smartly retry or use custom service discovery systems. It should be backwards compatible, as *http.Client fulfills that interface and can still be plugged in without changes. This is #39, and was proposed and designed in #12.

Generated servers will avoid an unnecessary string concatenation when handling requests; the string is now precomputed. This is #53.

Code generation now works correctly if a proto file imports another proto file found in the same directory. This was #15, fixed in #47.

#36 and #44 fixed typos in documenting comments and error messages.

All associated PRs bundled into this release can be tracked found here: https://github.com/twitchtv/twirp/pulls?q=is%3Apr+is%3Aclosed+milestone%3Av5.1.0