timeout

package
v1.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package timeout provides server and client timeout middleware

Index

Constants

View Source
const Key = "X-Leo-Timeout"

Key is the HTTP header key used to pass timeout settings

Variables

This section is empty.

Functions

func Client

func Client(duration time.Duration) client.Middleware

Client creates a client timeout middleware Parameters:

  • duration: Default timeout duration

Returns:

  • client.Middleware: Client middleware function

Behavior:

  1. Calculates timeout based on context deadline
  2. Sets timeout value in request header for server
  3. Creates context with timeout and invokes next handler

func Server

func Server(duration time.Duration) server.Middleware

Server creates a server timeout middleware Parameters:

  • duration: Default timeout duration

Returns:

  • server.Middleware: Server middleware function

Behavior:

  1. Checks for incoming timeout settings in request header
  2. Uses the smaller of incoming timeout and default timeout
  3. Creates context with timeout and invokes next handler

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL