Skip to content

Commit

Permalink
server: Clarify order of processing for option hooks.
Browse files Browse the repository at this point in the history
Make explicit that a CheckRequest hook is called after DecodeContext.
  • Loading branch information
creachadair committed Aug 25, 2021
1 parent a5d1a82 commit 3aa1529
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ type ServerOptions struct {
// If unset, ctx and params are used as given.
DecodeContext func(context.Context, string, json.RawMessage) (context.Context, json.RawMessage, error)

// If set, this function is called with the context and the client request
// to be delivered to the handler. If CheckRequest reports a non-nil error,
// the request fails with that error without invoking the handler.
// If set, this function is called with the context and client request
// (after decoding, if DecodeContext is set) that are to be delivered to the
// handler. If CheckRequest reports a non-nil error, the request fails with
// that error without invoking the handler.
CheckRequest func(ctx context.Context, req *Request) error

// If set, use this value to record server metrics. All servers created
Expand Down

0 comments on commit 3aa1529

Please sign in to comment.