From d44ed328d110ac19c278fabedafb601519287d58 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Tue, 11 Apr 2023 10:29:03 +0100 Subject: [PATCH] Add Handle option (#2627) --- options.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/options.go b/options.go index 687351ce03..ca1a74b829 100644 --- a/options.go +++ b/options.go @@ -112,6 +112,15 @@ func Context(ctx context.Context) Option { } } +// Handle will register a handler without any fuss +func Handle(v interface{}) Option { + return func(o *Options) { + o.Server.Handle( + o.Server.NewHandler(v), + ) + } +} + // HandleSignal toggles automatic installation of the signal handler that // traps TERM, INT, and QUIT. Users of this feature to disable the signal // handler, should control liveness of the service through the context.