Skip to content

Commit

Permalink
refactor: rename option to align with when it is called
Browse files Browse the repository at this point in the history
  • Loading branch information
crhntr committed Aug 5, 2024
1 parent 214671f commit 714c159
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func newOptions() Options {

func WithStructuredLogger(log *slog.Logger) Options { return newOptions().WithStructuredLogger(log) }
func WithReceiver(r any) Options { return newOptions().WithReceiver(r) }
func WithExecuteFunc(ex ExecuteFunc[any]) Options { return newOptions().WithExecuteFunc(ex) }
func WithDataFunc(ex ExecuteFunc[any]) Options { return newOptions().WithDataFunc(ex) }
func WithErrorFunc(ex ExecuteFunc[error]) Options { return newOptions().WithErrorFunc(ex) }

func (o Options) WithStructuredLogger(log *slog.Logger) Options {
Expand All @@ -52,7 +52,7 @@ func (o Options) WithReceiver(r any) Options {
return o
}

func (o Options) WithExecuteFunc(ex ExecuteFunc[any]) Options {
func (o Options) WithDataFunc(ex ExecuteFunc[any]) Options {
o.execute = ex
return o
}
Expand Down
2 changes: 1 addition & 1 deletion handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ func TestRoutes(t *testing.T) {
`{{define "GET /" }}<h1>Hello, friend!</h1>{{end}}`,
))
mux := http.NewServeMux()
err := muxt.Handlers(mux, ts, muxt.WithExecuteFunc(func(res http.ResponseWriter, req *http.Request, t *template.Template, logger *slog.Logger, data any) {
err := muxt.Handlers(mux, ts, muxt.WithDataFunc(func(res http.ResponseWriter, req *http.Request, t *template.Template, logger *slog.Logger, data any) {
res.WriteHeader(http.StatusBadRequest)
}))
require.NoError(t, err)
Expand Down

0 comments on commit 714c159

Please sign in to comment.