English | 中文
The ctx timeout middleware allows client timeouts to be controlled through Context.
- When using this middleware, it is necessary to manually add it on the client.
- The functionality of this middleware overlaps with that of client.DoDeadline and client.DoTimeout, so only one of them is needed to control the timeout.
- For HTTP2, this middleware is the only way to control the timeout, and
client.DoDeadline
andclient.DoTimeout
don't work.
Please refer to the example code: https://github.com/hertz-contrib/ctxtimeout/blob/main/examples