Skip to content

Commit

Permalink
get rid of unused pre/postLogicHook
Browse files Browse the repository at this point in the history
  • Loading branch information
mmartina committed Dec 7, 2018
1 parent 833452b commit a4ac4c7
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions generator/rest/httpHandlers.tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ import (
{{ $service := . }}
var (
preLogicHook = func(c context.Context, w http.ResponseWriter, r *http.Request) {}
postLogicHook = func(c context.Context, w http.ResponseWriter, r *http.Request, rc request.Context) {}
)
// HTTPHandler registers endpoint in new router
func (ts *{{.Name}}) HTTPHandler() http.Handler {
router := mux.NewRouter().StrictSlash(true)
Expand Down Expand Up @@ -52,9 +47,6 @@ func {{$oper.Name}}(service *{{$service.Name}}) http.HandlerFunc {
{{if NeedsContext $oper -}}
{{GetContextName $oper}} := ctx.New.CreateContext(r)
preLogicHook(c, w, r)
{{else -}}
preLogicHook(nil, w, r)
{{end -}}
rc := {{ $extractRequestContextMethod }}(c, r)
Expand Down Expand Up @@ -211,12 +203,6 @@ func {{$oper.Name}}(service *{{$service.Name}}) http.HandlerFunc {
}
{{end -}}
{{if NeedsContext $oper}}
postLogicHook(c, w, r, rc)
{{else -}}
postLogicHook(nil, w, r, rc)
{{end -}}
// write OK response body
{{if HasContentType . -}}
w.Header().Set("Content-Type", "{{GetContentType .}}")
Expand Down

0 comments on commit a4ac4c7

Please sign in to comment.