Skip to content

Commit

Permalink
Improve WithConditionalHandlerOptions docs (#548)
Browse files Browse the repository at this point in the history
Copy edits to the WithConditionalHandlerOptions GoDoc.
  • Loading branch information
akshayjshah authored Jul 13, 2023
1 parent e50dbcd commit e1ce6a6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,13 @@ func WithRequireConnectProtocolHeader() HandlerOption {
return &requireConnectProtocolHeaderOption{}
}

// WithConditionalHandlerOptions accepts a function that returns a HandlerOption.
// It's used to conditionally apply HandlerOption to a Handler based on the Spec.
// WithConditionalHandlerOptions allows procedures in the same service to have
// different configurations: for example, one procedure may need a much larger
// WithReadMaxBytes setting than the others.
//
// WithConditionalHandlerOptions takes a function which may inspect each
// procedure's Spec before deciding which options to apply. Returning a nil
// slice is safe.
func WithConditionalHandlerOptions(conditional func(spec Spec) []HandlerOption) HandlerOption {
return &conditionalHandlerOptions{conditional: conditional}
}
Expand Down

0 comments on commit e1ce6a6

Please sign in to comment.