ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## Request ID (请求ID) 中间件 Request ID 中间件为请求生成唯一的 ID。 *用法* ```go e.Use(middleware.RequestID()) ``` ### 自定义配置 *用法* ```go e.Use(middleware.RequestIDWithConfig(middleware.RequestIDConfig{ Generator: func() string { return customGenerator() }, })) ``` ### 配置 ```go RequestIDConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Generator defines a function to generate an ID. // Optional. Default value random.String(32). Generator func() string } ``` *默认配置* ```go DefaultRequestIDConfig = RequestIDConfig{ Skipper: DefaultSkipper, Generator: generator, } ```